├── LibertyV ├── avutil-52.dll ├── xcompress.dll ├── avcodec-55.dll ├── Resources │ ├── open.bmp │ ├── save.bmp │ ├── saveas.bmp │ └── preferences.png ├── liberty_v_logo.ico ├── Properties │ ├── Settings.settings │ ├── AssemblyInfo.cs │ └── Settings.Designer.cs ├── Rage │ ├── RPF │ │ ├── IStreamCreator.cs │ │ ├── V7 │ │ │ └── Entries │ │ │ │ ├── Entry.cs │ │ │ │ ├── RegularFileEntry.cs │ │ │ │ └── FileEntry.cs │ │ ├── ResourceStreamCreator.cs │ │ ├── ExternalFileStreamCreator.cs │ │ ├── RSC7StreamCreator.cs │ │ ├── CompressedFileStreamCreator.cs │ │ └── FileStreamCreator.cs │ ├── Audio │ │ └── AWC │ │ │ ├── ChunkStream.cs │ │ │ ├── IAudio.cs │ │ │ ├── SplittedAudio.cs │ │ │ ├── WAVFile.cs │ │ │ └── Audio.cs │ └── Exceptions.cs ├── GlobalOptions.cs ├── Utils │ ├── IProgressReport.cs │ ├── Hash.cs │ ├── StreamExtension.cs │ ├── GUI.cs │ ├── SubProgressReport.cs │ ├── StreamKeeper.cs │ └── Range.cs ├── Operations │ ├── IMenuItem.cs │ ├── Rename.cs │ ├── SeperatorMenuItem.cs │ ├── FileProporties.cs │ ├── Helper.cs │ ├── New.cs │ ├── RegularFileProperties.cs │ ├── Import.cs │ ├── ResourceProperties.cs │ ├── RPFOperations.cs │ ├── SubMenuItem.cs │ ├── OperationMenuItem.cs │ ├── MenuItemsList.cs │ ├── Delete.cs │ ├── AWCOperations.cs │ ├── RegularFileProperties.Designer.cs │ ├── Export.cs │ └── ResourceProperties.Designer.cs ├── app.config ├── EntryTreeNode.cs ├── EntryListViewItem.cs ├── Platform.cs ├── Settings.cs ├── PlatformSelection.cs ├── Program.cs └── LibertyV.sln ├── libav_wrapper ├── avcodec.lib ├── avutil.lib ├── include │ ├── libavutil │ │ ├── audioconvert.h │ │ ├── avconfig.h │ │ ├── time.h │ │ ├── random_seed.h │ │ ├── md5.h │ │ ├── adler32.h │ │ ├── intfloat_readwrite.h │ │ ├── file.h │ │ ├── xtea.h │ │ ├── intfloat.h │ │ ├── aes.h │ │ ├── base64.h │ │ ├── lfg.h │ │ ├── sha.h │ │ ├── avassert.h │ │ ├── blowfish.h │ │ ├── crc.h │ │ ├── hmac.h │ │ ├── bswap.h │ │ ├── version.h │ │ ├── cpu.h │ │ ├── error.h │ │ ├── attributes.h │ │ ├── mathematics.h │ │ └── rational.h │ └── libavcodec │ │ ├── dxva2.h │ │ ├── version.h │ │ ├── avfft.h │ │ └── vda.h ├── mp3dec.h ├── xma2dec.h └── libav_wrapper.vcxproj.filters ├── README.md ├── ffmpeg ├── README └── ffmpeg_xma2_patch.diff ├── lzx ├── lzx.vcxproj.filters ├── lzx.h └── lzx.vcxproj └── .gitignore /LibertyV/avutil-52.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koolkdev/libertyv/HEAD/LibertyV/avutil-52.dll -------------------------------------------------------------------------------- /LibertyV/xcompress.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koolkdev/libertyv/HEAD/LibertyV/xcompress.dll -------------------------------------------------------------------------------- /LibertyV/avcodec-55.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koolkdev/libertyv/HEAD/LibertyV/avcodec-55.dll -------------------------------------------------------------------------------- /libav_wrapper/avcodec.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koolkdev/libertyv/HEAD/libav_wrapper/avcodec.lib -------------------------------------------------------------------------------- /libav_wrapper/avutil.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koolkdev/libertyv/HEAD/libav_wrapper/avutil.lib -------------------------------------------------------------------------------- /LibertyV/Resources/open.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koolkdev/libertyv/HEAD/LibertyV/Resources/open.bmp -------------------------------------------------------------------------------- /LibertyV/Resources/save.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koolkdev/libertyv/HEAD/LibertyV/Resources/save.bmp -------------------------------------------------------------------------------- /LibertyV/liberty_v_logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koolkdev/libertyv/HEAD/LibertyV/liberty_v_logo.ico -------------------------------------------------------------------------------- /LibertyV/Resources/saveas.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koolkdev/libertyv/HEAD/LibertyV/Resources/saveas.bmp -------------------------------------------------------------------------------- /LibertyV/Resources/preferences.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/koolkdev/libertyv/HEAD/LibertyV/Resources/preferences.png -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/audioconvert.h: -------------------------------------------------------------------------------- 1 | 2 | #include "version.h" 3 | 4 | #if FF_API_AUDIOCONVERT 5 | #include "channel_layout.h" 6 | #endif 7 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/avconfig.h: -------------------------------------------------------------------------------- 1 | /* Generated by ffconf */ 2 | #ifndef AVUTIL_AVCONFIG_H 3 | #define AVUTIL_AVCONFIG_H 4 | #define AV_HAVE_BIGENDIAN 0 5 | #define AV_HAVE_FAST_UNALIGNED 1 6 | #endif /* AVUTIL_AVCONFIG_H */ 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LibertyV 2 | 3 | Grand Theft Auto V Resources Viewer 4 | 5 | ---- 6 | 7 | ## [Download - Click Here](http://goo.gl/H7yJdw) 8 | 9 | ---- 10 | 11 | ## Compiling 12 | Just open with Visual Studio 2010 the file LibertyV/LibertyV.sln and compile it. 13 | 14 | If you want to compile ffmpeg, follow the instructions in ffmpeg/README 15 | 16 | Good Luck! 17 | -------------------------------------------------------------------------------- /ffmpeg/README: -------------------------------------------------------------------------------- 1 | I slightly modified ffmpeg, so it will be able to decode xma. The header of xma is 4 bytes, but in wmapro it is a variable size. 2 | So I have two solutions: 3 | 1. Make the header shorter (And shift all the bits accordingly) 4 | 2. Change wmapro decoder. 5 | Right now I chose the second solution, because it is simpler. 6 | The patch file with the change is in this folder. 7 | 8 | If you want to compile it, follow the instructions at: 9 | http://libav.org/platform.html#Microsoft-Visual-C_002b_002b-or-Intel-C_002b_002b-Compiler-for-Windows 10 | 11 | Apply my patch, and configure libav with the following command line: 12 | ./configure --toolchain=msvc --disable-everything --enable-decoder=wmapro,mp3 --extra-cflags="-I ~/include" --enable-shared --disable-debug 13 | 14 | Good luck! -------------------------------------------------------------------------------- /ffmpeg/ffmpeg_xma2_patch.diff: -------------------------------------------------------------------------------- 1 | --- "wmaprodec.c.orig" 2 | +++ "wmaprodec.c" 3 | @@ -308,7 +308,7 @@ static av_cold int decode_init(AVCodecContext *avctx) 4 | s->log2_frame_size = av_log2(avctx->block_align) + 4; 5 | 6 | /** frame info */ 7 | - s->skip_frame = 1; /* skip first frame */ 8 | + s->skip_frame = 0; /* don't skip first frame */ 9 | s->packet_loss = 1; 10 | s->len_prefix = (s->decode_flags & 0x40); 11 | 12 | @@ -1541,6 +1541,7 @@ static int decode_packet(AVCodecContext *avctx, void *data, 13 | num_bits_prev_frame = get_bits(gb, s->log2_frame_size); 14 | av_dlog(avctx, "packet[%d]: nbpf %x\n", avctx->frame_number, 15 | num_bits_prev_frame); 16 | + skip_bits(gb, 11); 17 | 18 | /** check for packet loss */ 19 | if (!s->packet_loss && 20 | -------------------------------------------------------------------------------- /libav_wrapper/mp3dec.h: -------------------------------------------------------------------------------- 1 | #ifndef __MP3DEC_H__ 2 | #define __MP3DEC_H__ 3 | 4 | #include 5 | 6 | #define INPUT_BUFFER_SIZE (8192) 7 | #define PACKET_SIZE (1024) 8 | #define SAMPLES_PER_FRAME (1152) 9 | 10 | typedef struct { 11 | AVCodecContext * codec_ctx; 12 | AVPacket avpkt; 13 | AVFrame *decoded_frame; 14 | unsigned char frames[INPUT_BUFFER_SIZE]; 15 | int frame_samples_size; 16 | unsigned char * current_frame; 17 | int current_frame_pos; 18 | int bits; 19 | int (__stdcall *read_func)(unsigned char * dest, int offset, int dest_size); 20 | } mp3_dec_context; 21 | 22 | __declspec(dllexport) mp3_dec_context * mp3_dec_init(int (__stdcall *read_func)(unsigned char * dest, int offset, int dest_size), int bits); 23 | 24 | __declspec(dllexport) int mp3_dec_read(mp3_dec_context * ctx, unsigned char * output, int output_offset, int output_size); 25 | 26 | __declspec(dllexport) void mp3_dec_free(mp3_dec_context * ctx); 27 | 28 | #endif -------------------------------------------------------------------------------- /libav_wrapper/xma2dec.h: -------------------------------------------------------------------------------- 1 | #ifndef __XMA2DEC_H__ 2 | #define __XMA2DEC_H__ 3 | 4 | #include 5 | 6 | #define PACKET_SIZE (0x800) 7 | #define SAMPLES_PER_FRAME (0x200) 8 | 9 | typedef struct { 10 | AVCodecContext * codec_ctx; 11 | AVPacket avpkt; 12 | AVFrame *decoded_frame; 13 | unsigned char packet[PACKET_SIZE]; 14 | int offset; 15 | int frame_samples_size; 16 | unsigned char * current_frame; 17 | int current_frame_pos; 18 | int bits; 19 | } xma2_dec_context; 20 | 21 | __declspec(dllexport) xma2_dec_context * xma2_dec_init(int sample_rate, int channels, int bits); 22 | 23 | // Input must be 0x800 bytes 24 | __declspec(dllexport) int xma2_dec_prepare_packet(xma2_dec_context * ctx, unsigned char * input, int input_size); 25 | 26 | // read the decoded packet 27 | __declspec(dllexport) int xma2_dec_read(xma2_dec_context * ctx, unsigned char * output, int output_offset, int output_size); 28 | 29 | __declspec(dllexport) void xma2_dec_free(xma2_dec_context * ctx); 30 | 31 | #endif -------------------------------------------------------------------------------- /LibertyV/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 0 7 | 8 | 9 | key_xbox360.dat 10 | 11 | 12 | key_ps3.dat 13 | 14 | 15 | False 16 | 17 | 18 | False 19 | 20 | 21 | -------------------------------------------------------------------------------- /lzx/lzx.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | -------------------------------------------------------------------------------- /LibertyV/Rage/RPF/IStreamCreator.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.IO; 26 | 27 | namespace LibertyV.Rage.RPF 28 | { 29 | public interface IStreamCreator : IDisposable 30 | { 31 | Stream GetStream(); 32 | int GetSize(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /LibertyV/GlobalOptions.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | 26 | namespace LibertyV 27 | { 28 | static class GlobalOptions 29 | { 30 | static public Platform.PlatformType Platform = global::LibertyV.Platform.PlatformType.NONE; 31 | 32 | public static int AudioBits = 16; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /LibertyV/Utils/IProgressReport.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | 26 | namespace LibertyV.Utils 27 | { 28 | public interface IProgressReport 29 | { 30 | void SetProgress(long value); 31 | void SetMessage(string message); 32 | long GetFullValue(); 33 | bool IsCanceled(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /LibertyV/Operations/IMenuItem.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.Windows.Forms; 26 | 27 | namespace LibertyV.Operations 28 | { 29 | interface IMenuItem 30 | { 31 | ToolStripItem[] GetContextMenuItems(T obj); 32 | Action GetDefaultAction(T obj); 33 | Action GetActionByKey(Keys key, T obj); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /LibertyV/Rage/Audio/AWC/ChunkStream.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using LibertyV.Utils; 26 | using System.IO; 27 | 28 | namespace LibertyV.Rage.Audio.AWC 29 | { 30 | class ChunkStream : PartialStream 31 | { 32 | public ChunkStream(Stream stream, Structs.ChunkInfo chunk) 33 | : base(stream, chunk.Offset, chunk.Size) 34 | { 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /LibertyV/Rage/Audio/AWC/IAudio.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.IO; 26 | 27 | namespace LibertyV.Rage.Audio.AWC 28 | { 29 | interface IAudio : IDisposable 30 | { 31 | int GetBits(); 32 | uint GetSamplesCount(); 33 | int GetSamplesPerSecond(); 34 | int GetChannels(); 35 | 36 | int GetSize(); 37 | 38 | Stream GetPCMStream(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /libav_wrapper/libav_wrapper.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Header Files 28 | 29 | 30 | Header Files 31 | 32 | 33 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/time.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Libav. 3 | * 4 | * Libav is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * Libav is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with Libav; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_TIME_H 20 | #define AVUTIL_TIME_H 21 | 22 | #include 23 | 24 | /** 25 | * Get the current time in microseconds. 26 | */ 27 | int64_t av_gettime(void); 28 | 29 | /** 30 | * Sleep for a period of time. Although the duration is expressed in 31 | * microseconds, the actual delay may be rounded to the precision of the 32 | * system timer. 33 | * 34 | * @param usec Number of microseconds to sleep. 35 | * @return zero on success or (negative) error code. 36 | */ 37 | int av_usleep(unsigned usec); 38 | 39 | #endif /* AVUTIL_TIME_H */ 40 | -------------------------------------------------------------------------------- /LibertyV/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 0 12 | 13 | 14 | key_xbox360.dat 15 | 16 | 17 | key_ps3.dat 18 | 19 | 20 | False 21 | 22 | 23 | False 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /LibertyV/EntryTreeNode.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.Windows.Forms; 26 | using LibertyV.Rage.RPF.V7.Entries; 27 | 28 | namespace LibertyV 29 | { 30 | public class EntryTreeNode : TreeNode 31 | { 32 | public DirectoryEntry Entry; 33 | public EntryTreeNode(DirectoryEntry entry, EntryTreeNode[] children) 34 | : base(entry.Name, children) 35 | { 36 | this.Entry = entry; 37 | entry.Node = this; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /LibertyV/Rage/Exceptions.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | 26 | namespace LibertyV.Rage 27 | { 28 | public class RPFParsingException : Exception 29 | { 30 | public RPFParsingException(string error) 31 | : base(error) 32 | { 33 | } 34 | } 35 | 36 | public class RPFEntryParsingException : RPFParsingException 37 | { 38 | public RPFEntryParsingException(string error) 39 | : base(error) 40 | { 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/random_seed.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Baptiste Coudurier 3 | * 4 | * This file is part of Libav. 5 | * 6 | * Libav is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * Libav is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with Libav; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_RANDOM_SEED_H 22 | #define AVUTIL_RANDOM_SEED_H 23 | 24 | #include 25 | /** 26 | * @addtogroup lavu_crypto 27 | * @{ 28 | */ 29 | 30 | /** 31 | * Get random data. 32 | * 33 | * This function can be called repeatedly to generate more random bits 34 | * as needed. It is generally quite slow, and usually used to seed a 35 | * PRNG. As it uses /dev/urandom and /dev/random, the quality of the 36 | * returned random data depends on the platform. 37 | */ 38 | uint32_t av_get_random_seed(void); 39 | 40 | /** 41 | * @} 42 | */ 43 | 44 | #endif /* AVUTIL_RANDOM_SEED_H */ 45 | -------------------------------------------------------------------------------- /LibertyV/Utils/Hash.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | 26 | namespace LibertyV.Utils 27 | { 28 | static class Hash 29 | { 30 | public static uint jenkins_one_at_a_time_hash(string key) { 31 | uint hash = 0; 32 | foreach (char c in key) { 33 | hash += ((uint)c & 0xFF); 34 | hash += (hash << 10); 35 | hash ^= (hash >> 6); 36 | } 37 | hash += (hash << 3); 38 | hash ^= (hash >> 11); 39 | hash += (hash << 15); 40 | return hash; 41 | } 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /LibertyV/Operations/Rename.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using LibertyV.Rage.RPF.V7.Entries; 26 | 27 | namespace LibertyV.Operations 28 | { 29 | static class Rename 30 | { 31 | public static void RenameFile(FileEntry entry) 32 | { 33 | // TODO: Move the handling to here? 34 | entry.ViewItem.ListView.LabelEdit = true; 35 | entry.ViewItem.BeginEdit(); 36 | } 37 | 38 | public static void RenameFolder(DirectoryEntry entry) 39 | { 40 | entry.Node.TreeView.LabelEdit = true; 41 | entry.Node.BeginEdit(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /LibertyV/Operations/SeperatorMenuItem.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.Windows.Forms; 26 | 27 | namespace LibertyV.Operations 28 | { 29 | class SeperatorMenuItem : IMenuItem 30 | { 31 | public ToolStripItem[] GetContextMenuItems(T obj) 32 | { 33 | return new ToolStripItem[] { new ToolStripSeparator() }; 34 | } 35 | 36 | 37 | public Action GetDefaultAction(T obj) 38 | { 39 | return null; 40 | } 41 | 42 | public Action GetActionByKey(Keys key, T obj) 43 | { 44 | return null; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of Libav. 5 | * 6 | * Libav is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * Libav is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with Libav; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_MD5_H 22 | #define AVUTIL_MD5_H 23 | 24 | #include 25 | 26 | #include "attributes.h" 27 | #include "version.h" 28 | 29 | /** 30 | * @defgroup lavu_md5 MD5 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | #if FF_API_CONTEXT_SIZE 36 | extern attribute_deprecated const int av_md5_size; 37 | #endif 38 | 39 | struct AVMD5; 40 | 41 | struct AVMD5 *av_md5_alloc(void); 42 | void av_md5_init(struct AVMD5 *ctx); 43 | void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, const int len); 44 | void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); 45 | void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); 46 | 47 | /** 48 | * @} 49 | */ 50 | 51 | #endif /* AVUTIL_MD5_H */ 52 | -------------------------------------------------------------------------------- /LibertyV/Operations/FileProporties.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using LibertyV.Rage.RPF.V7.Entries; 26 | 27 | namespace LibertyV.Operations 28 | { 29 | static class FileProperties 30 | { 31 | public static void ShowFileProperties(FileEntry entry) 32 | { 33 | if (entry.IsRegularFile()) 34 | { 35 | new RegularFileProperties(entry as RegularFileEntry).ShowDialog(); 36 | } 37 | else if (entry.IsResource()) 38 | { 39 | new ResourceProperties(entry as ResourceEntry).ShowDialog(); 40 | } 41 | entry.ViewItem.Update(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/adler32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Mans Rullgard 3 | * 4 | * This file is part of Libav. 5 | * 6 | * Libav is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * Libav is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with Libav; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_ADLER32_H 22 | #define AVUTIL_ADLER32_H 23 | 24 | #include 25 | #include "attributes.h" 26 | 27 | /** 28 | * @ingroup lavu_crypto 29 | * Calculate the Adler32 checksum of a buffer. 30 | * 31 | * Passing the return value to a subsequent av_adler32_update() call 32 | * allows the checksum of multiple buffers to be calculated as though 33 | * they were concatenated. 34 | * 35 | * @param adler initial checksum value 36 | * @param buf pointer to input buffer 37 | * @param len size of input buffer 38 | * @return updated checksum 39 | */ 40 | unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, 41 | unsigned int len) av_pure; 42 | 43 | #endif /* AVUTIL_ADLER32_H */ 44 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/intfloat_readwrite.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2005 Michael Niedermayer 3 | * 4 | * This file is part of Libav. 5 | * 6 | * Libav is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * Libav is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with Libav; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_INTFLOAT_READWRITE_H 22 | #define AVUTIL_INTFLOAT_READWRITE_H 23 | 24 | #include 25 | #include "attributes.h" 26 | 27 | /* IEEE 80 bits extended float */ 28 | typedef struct AVExtFloat { 29 | uint8_t exponent[2]; 30 | uint8_t mantissa[8]; 31 | } AVExtFloat; 32 | 33 | attribute_deprecated double av_int2dbl(int64_t v) av_const; 34 | attribute_deprecated float av_int2flt(int32_t v) av_const; 35 | attribute_deprecated double av_ext2dbl(const AVExtFloat ext) av_const; 36 | attribute_deprecated int64_t av_dbl2int(double d) av_const; 37 | attribute_deprecated int32_t av_flt2int(float d) av_const; 38 | attribute_deprecated AVExtFloat av_dbl2ext(double d) av_const; 39 | 40 | #endif /* AVUTIL_INTFLOAT_READWRITE_H */ 41 | -------------------------------------------------------------------------------- /LibertyV/Rage/RPF/V7/Entries/Entry.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.IO; 26 | using LibertyV.Utils; 27 | 28 | namespace LibertyV.Rage.RPF.V7.Entries 29 | { 30 | public abstract class Entry : IDisposable 31 | { 32 | public String Name; 33 | public DirectoryEntry Parent = null; 34 | 35 | public Entry(String filename) { 36 | this.Name = filename; 37 | } 38 | 39 | public virtual void Export(String foldername, IProgressReport progress = null) 40 | { 41 | throw new Exception("Not implemented"); 42 | } 43 | 44 | public virtual void AddToList(List entryList) 45 | { 46 | entryList.Add(this); 47 | } 48 | 49 | public abstract void Dispose(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /LibertyV/Operations/Helper.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using LibertyV.Rage.RPF.V7.Entries; 26 | using System.Windows.Forms; 27 | 28 | namespace LibertyV.Operations 29 | { 30 | static class Helper 31 | { 32 | static public void SelectAll(DirectoryEntry entry) 33 | { 34 | if (entry.FilesListView != null) 35 | { 36 | foreach (ListViewItem item in entry.FilesListView.Items) 37 | { 38 | item.Selected = true; 39 | } 40 | } 41 | } 42 | static public void SelectAll(FileEntry entry) 43 | { 44 | SelectAll(entry.Parent); 45 | } 46 | static public void SelectAll(List entries) 47 | { 48 | SelectAll(entries[0]); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /LibertyV/Rage/RPF/ResourceStreamCreator.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using LibertyV.Utils; 26 | using LibertyV.Rage.RPF.V7.Entries; 27 | using System.IO; 28 | 29 | namespace LibertyV.Rage.RPF 30 | { 31 | public class ResourceStreamCreator : CompressedFileStreamCreator 32 | { 33 | 34 | // Ignore first 0x10, it is supposed to be the header, but is it junk since we got all the information that we need about the resource from the flags? 35 | public ResourceStreamCreator(Stream fileStream, long offset, int compressedSize, uint systemFlag, uint graphicsFlag, string resourceType) 36 | : base(fileStream, offset + 0x10, compressedSize - 0x10, (int)(ResourceEntry.GetSizeFromSystemFlag(systemFlag) + ResourceEntry.GetSizeFromGraphicsFlag(graphicsFlag)), ResourceEntry.IsResourceEncrypted(resourceType)) 37 | { 38 | } 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /LibertyV/Rage/RPF/ExternalFileStreamCreator.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.IO; 26 | using LibertyV.Utils; 27 | 28 | namespace LibertyV.Rage.RPF 29 | { 30 | public class ExternalFileStreamCreator : IStreamCreator 31 | { 32 | private Stream Stream; 33 | 34 | public ExternalFileStreamCreator(Stream stream) 35 | { 36 | this.Stream = stream; 37 | } 38 | 39 | public virtual Stream GetStream() 40 | { 41 | // just a way to reset and duplicate the stream 42 | return new PartialStream(this.Stream, 0, this.GetSize()); 43 | } 44 | 45 | public virtual int GetSize() 46 | { 47 | return (int)this.Stream.Length; 48 | } 49 | 50 | public void Dispose() 51 | { 52 | this.Stream.Close(); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /LibertyV/Operations/New.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using LibertyV.Rage.RPF.V7.Entries; 26 | 27 | namespace LibertyV.Operations 28 | { 29 | static class New 30 | { 31 | public static void NewFolder(DirectoryEntry entry) 32 | { 33 | string name = "New Folder"; 34 | int i = 1; 35 | for (; entry.GetEntries().Any(e => e.Name == name); ++i, name = String.Format("New Folder ({0})", i)) ; 36 | DirectoryEntry addedFolder = new DirectoryEntry(name, new List()); 37 | entry.AddEntry(addedFolder); 38 | if (!entry.Node.IsExpanded) 39 | { 40 | entry.Node.Expand(); 41 | } 42 | addedFolder.Node.TreeView.SelectedNode = addedFolder.Node; 43 | addedFolder.Node.TreeView.LabelEdit = true; 44 | addedFolder.Node.BeginEdit(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /LibertyV/EntryListViewItem.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.Windows.Forms; 26 | using LibertyV.Rage.RPF.V7.Entries; 27 | 28 | namespace LibertyV 29 | { 30 | public class EntryListViewItem : ListViewItem 31 | { 32 | public FileEntry Entry; 33 | public EntryListViewItem(FileEntry entry) 34 | : base(entry.Name) 35 | { 36 | this.Entry = entry; 37 | this.Entry.ViewItem = this; 38 | Update(); 39 | } 40 | 41 | public void Update() 42 | { 43 | this.SubItems.Clear(); 44 | base.Text = this.Entry.Name; 45 | this.SubItems.Add(String.Format("{0:n0}", Entry.Data.GetSize())); 46 | 47 | if (this.Entry is ResourceEntry) 48 | { 49 | this.SubItems.Add((this.Entry as ResourceEntry).Version.ToString()); 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /LibertyV/Operations/RegularFileProperties.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.ComponentModel; 24 | using System.Data; 25 | using System.Drawing; 26 | using System.Linq; 27 | using System.Text; 28 | using System.Windows.Forms; 29 | using LibertyV.Rage.RPF.V7.Entries; 30 | 31 | namespace LibertyV.Operations 32 | { 33 | public partial class RegularFileProperties : Form 34 | { 35 | RegularFileEntry Entry; 36 | public RegularFileProperties(RegularFileEntry entry) 37 | { 38 | InitializeComponent(); 39 | 40 | this.Entry = entry; 41 | this.isCompressedCheckBox.Checked = this.Entry.Compressed; 42 | } 43 | 44 | public new void Close() 45 | { 46 | this.Entry.Compressed = this.isCompressedCheckBox.Checked; 47 | 48 | base.Close(); 49 | } 50 | 51 | private void button1_Click(object sender, EventArgs e) 52 | { 53 | Close(); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /LibertyV/Operations/Import.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using LibertyV.Rage.RPF.V7.Entries; 26 | using System.Windows.Forms; 27 | using LibertyV.Utils; 28 | using System.IO; 29 | using LibertyV.Rage.RPF.V7; 30 | using LibertyV.Rage.RPF; 31 | 32 | namespace LibertyV.Operations 33 | { 34 | static class Import 35 | { 36 | public static void ImportFiles(DirectoryEntry entry) 37 | { 38 | OpenFileDialog fileDialog = new OpenFileDialog(); 39 | fileDialog.Multiselect = true; 40 | if (fileDialog.ShowDialog() == DialogResult.OK) 41 | { 42 | new ImportingWindow(entry, Path.GetDirectoryName(fileDialog.FileNames[0]), fileDialog.FileNames.Select(filename => Path.GetFileName(filename)).ToList()).ShowDialog(); 43 | } 44 | } 45 | public static void ImportFolder(DirectoryEntry entry) 46 | { 47 | string folder = GUI.FolderSelection(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /LibertyV/Rage/RPF/RSC7StreamCreator.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using LibertyV.Utils; 26 | using LibertyV.Rage.RPF.V7.Entries; 27 | using System.IO; 28 | 29 | namespace LibertyV.Rage.RPF 30 | { 31 | public class RSC7StreamCreator : IStreamCreator 32 | { 33 | 34 | private Stream Stream; 35 | 36 | // Same as ExternalFileStreamCreator, but this time we ignore the first 0x10 bytes 37 | public RSC7StreamCreator(Stream stream) 38 | { 39 | this.Stream = stream; 40 | } 41 | 42 | public virtual Stream GetStream() 43 | { 44 | // just a way to reset and duplicate the stream 45 | return new PartialStream(this.Stream, 0x10, this.GetSize()); 46 | } 47 | 48 | public virtual int GetSize() 49 | { 50 | return (int)this.Stream.Length - 0x10; 51 | } 52 | 53 | public void Dispose() 54 | { 55 | Stream.Close(); 56 | } 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Libav. 3 | * 4 | * Libav is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * Libav is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with Libav; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_FILE_H 20 | #define AVUTIL_FILE_H 21 | 22 | #include 23 | 24 | #include "avutil.h" 25 | 26 | /** 27 | * @file 28 | * Misc file utilities. 29 | */ 30 | 31 | /** 32 | * Read the file with name filename, and put its content in a newly 33 | * allocated buffer or map it with mmap() when available. 34 | * In case of success set *bufptr to the read or mmapped buffer, and 35 | * *size to the size in bytes of the buffer in *bufptr. 36 | * The returned buffer must be released with av_file_unmap(). 37 | * 38 | * @param log_offset loglevel offset used for logging 39 | * @param log_ctx context used for logging 40 | * @return a non negative number in case of success, a negative value 41 | * corresponding to an AVERROR error code in case of failure 42 | */ 43 | int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, 44 | int log_offset, void *log_ctx); 45 | 46 | /** 47 | * Unmap or free the buffer bufptr created by av_file_map(). 48 | * 49 | * @param size size in bytes of bufptr, must be the same as returned 50 | * by av_file_map() 51 | */ 52 | void av_file_unmap(uint8_t *bufptr, size_t size); 53 | 54 | #endif /* AVUTIL_FILE_H */ 55 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/xtea.h: -------------------------------------------------------------------------------- 1 | /* 2 | * A 32-bit implementation of the XTEA algorithm 3 | * 4 | * This file is part of Libav. 5 | * 6 | * Libav is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * Libav is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with Libav; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_XTEA_H 22 | #define AVUTIL_XTEA_H 23 | 24 | #include 25 | 26 | /** 27 | * @defgroup lavu_xtea XTEA 28 | * @ingroup lavu_crypto 29 | * @{ 30 | */ 31 | 32 | typedef struct AVXTEA { 33 | uint32_t key[16]; 34 | } AVXTEA; 35 | 36 | /** 37 | * Initialize an AVXTEA context. 38 | * 39 | * @param ctx an AVXTEA context 40 | * @param key a key of 16 bytes used for encryption/decryption 41 | */ 42 | void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]); 43 | 44 | /** 45 | * Encrypt or decrypt a buffer using a previously initialized context. 46 | * 47 | * @param ctx an AVXTEA context 48 | * @param dst destination array, can be equal to src 49 | * @param src source array, can be equal to dst 50 | * @param count number of 8 byte blocks 51 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 52 | * @param decrypt 0 for encryption, 1 for decryption 53 | */ 54 | void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, 55 | int count, uint8_t *iv, int decrypt); 56 | 57 | /** 58 | * @} 59 | */ 60 | 61 | #endif /* AVUTIL_XTEA_H */ 62 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/intfloat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Mans Rullgard 3 | * 4 | * This file is part of Libav. 5 | * 6 | * Libav is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * Libav is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with Libav; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_INTFLOAT_H 22 | #define AVUTIL_INTFLOAT_H 23 | 24 | #include 25 | #include "attributes.h" 26 | 27 | union av_intfloat32 { 28 | uint32_t i; 29 | float f; 30 | }; 31 | 32 | union av_intfloat64 { 33 | uint64_t i; 34 | double f; 35 | }; 36 | 37 | /** 38 | * Reinterpret a 32-bit integer as a float. 39 | */ 40 | static av_always_inline float av_int2float(uint32_t i) 41 | { 42 | union av_intfloat32 v; 43 | v.i = i; 44 | return v.f; 45 | } 46 | 47 | /** 48 | * Reinterpret a float as a 32-bit integer. 49 | */ 50 | static av_always_inline uint32_t av_float2int(float f) 51 | { 52 | union av_intfloat32 v; 53 | v.f = f; 54 | return v.i; 55 | } 56 | 57 | /** 58 | * Reinterpret a 64-bit integer as a double. 59 | */ 60 | static av_always_inline double av_int2double(uint64_t i) 61 | { 62 | union av_intfloat64 v; 63 | v.i = i; 64 | return v.f; 65 | } 66 | 67 | /** 68 | * Reinterpret a double as a 64-bit integer. 69 | */ 70 | static av_always_inline uint64_t av_double2int(double f) 71 | { 72 | union av_intfloat64 v; 73 | v.f = f; 74 | return v.i; 75 | } 76 | 77 | #endif /* AVUTIL_INTFLOAT_H */ 78 | -------------------------------------------------------------------------------- /LibertyV/Rage/RPF/CompressedFileStreamCreator.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using LibertyV.Utils; 26 | using System.IO; 27 | 28 | namespace LibertyV.Rage.RPF 29 | { 30 | public class CompressedFileStreamCreator : FileStreamCreator 31 | { 32 | private int UncompressedSize; 33 | public bool Encrypted; 34 | 35 | public CompressedFileStreamCreator(Stream fileStream, long offset, int compressedSize, int uncompressedSize, bool encrypted = true) 36 | : base(fileStream, offset, compressedSize) 37 | { 38 | this.UncompressedSize = uncompressedSize; 39 | this.Encrypted = encrypted; 40 | } 41 | 42 | public override Stream GetStream() 43 | { 44 | if (this.Encrypted) { 45 | return Platform.GetDecompressStream(AES.DecryptStream(base.GetStream())); 46 | } else { 47 | return Platform.GetDecompressStream(base.GetStream()); 48 | } 49 | } 50 | 51 | public override int GetSize() 52 | { 53 | return this.UncompressedSize; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /LibertyV/Operations/ResourceProperties.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.ComponentModel; 24 | using System.Data; 25 | using System.Drawing; 26 | using System.Linq; 27 | using System.Text; 28 | using System.Windows.Forms; 29 | using LibertyV.Rage.RPF.V7.Entries; 30 | 31 | namespace LibertyV.Operations 32 | { 33 | public partial class ResourceProperties : Form 34 | { 35 | private ResourceEntry Entry; 36 | 37 | public ResourceProperties(ResourceEntry entry) 38 | { 39 | InitializeComponent(); 40 | 41 | this.Entry = entry; 42 | this.typeTextBox.Text = entry.Version.ToString(); 43 | } 44 | 45 | public new void Close() 46 | { 47 | int newType; 48 | if (!int.TryParse(this.typeTextBox.Text, out newType) || newType >= 0x100) 49 | { 50 | MessageBox.Show("Invalid type (must be 0-256)"); 51 | return; 52 | } 53 | Entry.Version = newType; 54 | 55 | base.Close(); 56 | } 57 | 58 | private void button1_Click(object sender, EventArgs e) 59 | { 60 | Close(); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /LibertyV/Platform.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.IO; 26 | using System.IO.Compression; 27 | using LibertyV.Utils; 28 | 29 | namespace LibertyV 30 | { 31 | static class Platform 32 | { 33 | public enum PlatformType 34 | { 35 | NONE, 36 | XBOX360, 37 | PLAYSTATION3 38 | }; 39 | 40 | public static Stream GetCompressStream(Stream stream) 41 | { 42 | if (GlobalOptions.Platform == PlatformType.PLAYSTATION3) 43 | { 44 | return new DeflateStream(stream, CompressionMode.Compress); 45 | } 46 | else 47 | { 48 | return new XMemCompressStream(stream); 49 | } 50 | } 51 | 52 | public static Stream GetDecompressStream(Stream stream) 53 | { 54 | if (GlobalOptions.Platform == PlatformType.PLAYSTATION3) 55 | { 56 | return new DeflateStream(stream, CompressionMode.Decompress); 57 | } 58 | else 59 | { 60 | return new XMemDecompressStream(stream); 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/aes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2007 Michael Niedermayer 3 | * 4 | * This file is part of Libav. 5 | * 6 | * Libav is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * Libav is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with Libav; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_AES_H 22 | #define AVUTIL_AES_H 23 | 24 | #include 25 | 26 | #include "attributes.h" 27 | #include "version.h" 28 | 29 | /** 30 | * @defgroup lavu_aes AES 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | #if FF_API_CONTEXT_SIZE 36 | extern attribute_deprecated const int av_aes_size; 37 | #endif 38 | 39 | struct AVAES; 40 | 41 | /** 42 | * Allocate an AVAES context. 43 | */ 44 | struct AVAES *av_aes_alloc(void); 45 | 46 | /** 47 | * Initialize an AVAES context. 48 | * @param key_bits 128, 192 or 256 49 | * @param decrypt 0 for encryption, 1 for decryption 50 | */ 51 | int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt); 52 | 53 | /** 54 | * Encrypt or decrypt a buffer using a previously initialized context. 55 | * @param count number of 16 byte blocks 56 | * @param dst destination array, can be equal to src 57 | * @param src source array, can be equal to dst 58 | * @param iv initialization vector for CBC mode, if NULL then ECB will be used 59 | * @param decrypt 0 for encryption, 1 for decryption 60 | */ 61 | void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | #endif /* AVUTIL_AES_H */ 68 | -------------------------------------------------------------------------------- /LibertyV/Settings.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | namespace LibertyV.Properties { 22 | 23 | 24 | // This class allows you to handle specific events on the settings class: 25 | // The SettingChanging event is raised before a setting's value is changed. 26 | // The PropertyChanged event is raised after a setting's value is changed. 27 | // The SettingsLoaded event is raised after the setting values are loaded. 28 | // The SettingsSaving event is raised before the setting values are saved. 29 | internal sealed partial class Settings { 30 | 31 | public Settings() { 32 | // // To add event handlers for saving and changing settings, uncomment the lines below: 33 | // 34 | // this.SettingChanging += this.SettingChangingEventHandler; 35 | // 36 | // this.SettingsSaving += this.SettingsSavingEventHandler; 37 | // 38 | } 39 | 40 | private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { 41 | // Add code to handle the SettingChangingEvent event here. 42 | } 43 | 44 | private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { 45 | // Add code to handle the SettingsSaving event here. 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com) 3 | * 4 | * This file is part of Libav. 5 | * 6 | * Libav is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * Libav is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with Libav; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_BASE64_H 22 | #define AVUTIL_BASE64_H 23 | 24 | #include 25 | 26 | /** 27 | * @defgroup lavu_base64 Base64 28 | * @ingroup lavu_crypto 29 | * @{ 30 | */ 31 | 32 | 33 | /** 34 | * Decode a base64-encoded string. 35 | * 36 | * @param out buffer for decoded data 37 | * @param in null-terminated input string 38 | * @param out_size size in bytes of the out buffer, must be at 39 | * least 3/4 of the length of in 40 | * @return number of bytes written, or a negative value in case of 41 | * invalid input 42 | */ 43 | int av_base64_decode(uint8_t *out, const char *in, int out_size); 44 | 45 | /** 46 | * Encode data to base64 and null-terminate. 47 | * 48 | * @param out buffer for encoded data 49 | * @param out_size size in bytes of the output buffer, must be at 50 | * least AV_BASE64_SIZE(in_size) 51 | * @param in_size size in bytes of the 'in' buffer 52 | * @return 'out' or NULL in case of error 53 | */ 54 | char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); 55 | 56 | /** 57 | * Calculate the output size needed to base64-encode x bytes. 58 | */ 59 | #define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) 60 | 61 | /** 62 | * @} 63 | */ 64 | 65 | #endif /* AVUTIL_BASE64_H */ 66 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/lfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lagged Fibonacci PRNG 3 | * Copyright (c) 2008 Michael Niedermayer 4 | * 5 | * This file is part of Libav. 6 | * 7 | * Libav is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * Libav is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with Libav; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef AVUTIL_LFG_H 23 | #define AVUTIL_LFG_H 24 | 25 | typedef struct AVLFG { 26 | unsigned int state[64]; 27 | int index; 28 | } AVLFG; 29 | 30 | void av_lfg_init(AVLFG *c, unsigned int seed); 31 | 32 | /** 33 | * Get the next random unsigned 32-bit number using an ALFG. 34 | * 35 | * Please also consider a simple LCG like state= state*1664525+1013904223, 36 | * it may be good enough and faster for your specific use case. 37 | */ 38 | static inline unsigned int av_lfg_get(AVLFG *c){ 39 | c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; 40 | return c->state[c->index++ & 63]; 41 | } 42 | 43 | /** 44 | * Get the next random unsigned 32-bit number using a MLFG. 45 | * 46 | * Please also consider av_lfg_get() above, it is faster. 47 | */ 48 | static inline unsigned int av_mlfg_get(AVLFG *c){ 49 | unsigned int a= c->state[(c->index-55) & 63]; 50 | unsigned int b= c->state[(c->index-24) & 63]; 51 | return c->state[c->index++ & 63] = 2*a*b+a+b; 52 | } 53 | 54 | /** 55 | * Get the next two numbers generated by a Box-Muller Gaussian 56 | * generator using the random numbers issued by lfg. 57 | * 58 | * @param out array where the two generated numbers are placed 59 | */ 60 | void av_bmg_get(AVLFG *lfg, double out[2]); 61 | 62 | #endif /* AVUTIL_LFG_H */ 63 | -------------------------------------------------------------------------------- /LibertyV/Operations/RPFOperations.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using LibertyV.Rage.RPF.V7.Entries; 26 | using System.IO; 27 | using System.Diagnostics; 28 | using LibertyV.Rage.RPF.V7; 29 | using LibertyV.Rage.RPF; 30 | 31 | namespace LibertyV.Operations 32 | { 33 | static class RPFOperations 34 | { 35 | public static bool IsRPF(FileEntry entry) 36 | { 37 | return entry.GetExtension() == ".rpf"; 38 | } 39 | 40 | public static void OpenRPF(FileEntry entry) 41 | { 42 | string tempPath = Path.GetTempFileName(); 43 | Stream tempFile = new FileStream(tempPath, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite, 0x1000, FileOptions.DeleteOnClose); 44 | LibertyV window = new LibertyV(new RPF7File(entry.Data.GetStream(), entry.Name), tempPath); 45 | window.ShowDialog(); 46 | if (tempFile.Length > 0) 47 | { 48 | // Replace data 49 | entry.Data.Dispose(); 50 | entry.Data = new ExternalFileStreamCreator(tempFile); 51 | entry.ViewItem.Update(); 52 | } 53 | else 54 | { 55 | tempFile.Close(); 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/sha.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 Michael Niedermayer 3 | * 4 | * This file is part of Libav. 5 | * 6 | * Libav is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * Libav is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with Libav; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_SHA_H 22 | #define AVUTIL_SHA_H 23 | 24 | #include 25 | 26 | #include "attributes.h" 27 | #include "version.h" 28 | 29 | /** 30 | * @defgroup lavu_sha SHA 31 | * @ingroup lavu_crypto 32 | * @{ 33 | */ 34 | 35 | #if FF_API_CONTEXT_SIZE 36 | extern attribute_deprecated const int av_sha_size; 37 | #endif 38 | 39 | struct AVSHA; 40 | 41 | /** 42 | * Allocate an AVSHA context. 43 | */ 44 | struct AVSHA *av_sha_alloc(void); 45 | 46 | /** 47 | * Initialize SHA-1 or SHA-2 hashing. 48 | * 49 | * @param context pointer to the function context (of size av_sha_size) 50 | * @param bits number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits) 51 | * @return zero if initialization succeeded, -1 otherwise 52 | */ 53 | int av_sha_init(struct AVSHA* context, int bits); 54 | 55 | /** 56 | * Update hash value. 57 | * 58 | * @param context hash function context 59 | * @param data input data to update hash with 60 | * @param len input data length 61 | */ 62 | void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len); 63 | 64 | /** 65 | * Finish hashing and output digest value. 66 | * 67 | * @param context hash function context 68 | * @param digest buffer where output digest value is stored 69 | */ 70 | void av_sha_final(struct AVSHA* context, uint8_t *digest); 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | #endif /* AVUTIL_SHA_H */ 77 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/avassert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2010 Michael Niedermayer 3 | * 4 | * This file is part of Libav. 5 | * 6 | * Libav is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * Libav is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with Libav; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * simple assert() macros that are a bit more flexible than ISO C assert(). 24 | * @author Michael Niedermayer 25 | */ 26 | 27 | #ifndef AVUTIL_AVASSERT_H 28 | #define AVUTIL_AVASSERT_H 29 | 30 | #include 31 | #include "avutil.h" 32 | #include "log.h" 33 | 34 | /** 35 | * assert() equivalent, that is always enabled. 36 | */ 37 | #define av_assert0(cond) do { \ 38 | if (!(cond)) { \ 39 | av_log(NULL, AV_LOG_FATAL, "Assertion %s failed at %s:%d\n", \ 40 | AV_STRINGIFY(cond), __FILE__, __LINE__); \ 41 | abort(); \ 42 | } \ 43 | } while (0) 44 | 45 | 46 | /** 47 | * assert() equivalent, that does not lie in speed critical code. 48 | * These asserts() thus can be enabled without fearing speedloss. 49 | */ 50 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0 51 | #define av_assert1(cond) av_assert0(cond) 52 | #else 53 | #define av_assert1(cond) ((void)0) 54 | #endif 55 | 56 | 57 | /** 58 | * assert() equivalent, that does lie in speed critical code. 59 | */ 60 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 61 | #define av_assert2(cond) av_assert0(cond) 62 | #else 63 | #define av_assert2(cond) ((void)0) 64 | #endif 65 | 66 | #endif /* AVUTIL_AVASSERT_H */ 67 | -------------------------------------------------------------------------------- /LibertyV/Rage/RPF/FileStreamCreator.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.IO; 26 | using LibertyV.Utils; 27 | 28 | namespace LibertyV.Rage.RPF 29 | { 30 | public class FileStreamCreator : IStreamCreator 31 | { 32 | public readonly long Offset; 33 | public readonly int Size; 34 | public readonly Stream FileStream; 35 | 36 | public FileStreamCreator(Stream fileStream, long offset, int size) 37 | { 38 | this.FileStream = fileStream; 39 | this.Offset = offset; 40 | this.Size = size; 41 | } 42 | 43 | public virtual Stream GetStream() 44 | { 45 | return new PartialStream(this.FileStream, this.Offset, this.Size); 46 | } 47 | 48 | public virtual int GetSize() 49 | { 50 | return this.Size; 51 | } 52 | 53 | public void WriteRaw(Stream stream) 54 | { 55 | // Write the original data 56 | using (Stream input = new PartialStream(this.FileStream, this.Offset, this.Size)) 57 | { 58 | input.CopyTo(stream); 59 | } 60 | } 61 | 62 | public void Dispose() 63 | { 64 | // We don't want to close the file because it is used file 65 | // If you don't want to point to the original file, use external file stream creator instead 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /LibertyV/Operations/SubMenuItem.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.Windows.Forms; 26 | 27 | namespace LibertyV.Operations 28 | { 29 | class SubMenuItem : IMenuItem 30 | { 31 | public SubMenuItem(string text, MenuItemsList list) 32 | { 33 | this.Text = text; 34 | this.List = list; 35 | } 36 | 37 | private string Text; 38 | private MenuItemsList List; 39 | 40 | public ToolStripItem[] GetContextMenuItems(T obj) 41 | { 42 | ToolStripMenuItem item = new ToolStripMenuItem(Text); 43 | item.DropDownItems.AddRange(List.GetContextMenuItems(obj)); 44 | return new ToolStripItem[] { item }; 45 | } 46 | 47 | public Action GetDefaultAction(T obj) 48 | { 49 | return List.GetDefaultAction(obj); 50 | } 51 | 52 | public Action GetActionByKey(Keys key, T obj) 53 | { 54 | return List.GetActionByKey(key, obj); 55 | } 56 | 57 | public ToolStripItem GetContextMenuItemUpdatedOnOpening(T obj) 58 | { 59 | ToolStripMenuItem item = new ToolStripMenuItem(Text); 60 | item.DropDownOpening += (o, e) => 61 | { 62 | item.DropDownItems.Clear(); 63 | item.DropDownItems.AddRange(List.GetContextMenuItems(obj)); 64 | }; 65 | return item; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /LibertyV/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System.Reflection; 22 | using System.Runtime.CompilerServices; 23 | using System.Runtime.InteropServices; 24 | 25 | // General Information about an assembly is controlled through the following 26 | // set of attributes. Change these attribute values to modify the information 27 | // associated with an assembly. 28 | [assembly: AssemblyTitle("RPF7Viewer")] 29 | [assembly: AssemblyDescription("")] 30 | [assembly: AssemblyConfiguration("")] 31 | [assembly: AssemblyCompany("")] 32 | [assembly: AssemblyProduct("RPF7Viewer")] 33 | [assembly: AssemblyCopyright("Copyright © 2013")] 34 | [assembly: AssemblyTrademark("")] 35 | [assembly: AssemblyCulture("")] 36 | 37 | // Setting ComVisible to false makes the types in this assembly not visible 38 | // to COM components. If you need to access a type in this assembly from 39 | // COM, set the ComVisible attribute to true on that type. 40 | [assembly: ComVisible(false)] 41 | 42 | // The following GUID is for the ID of the typelib if this project is exposed to COM 43 | [assembly: Guid("53967342-f0aa-4446-9c7f-bb94835583cb")] 44 | 45 | // Version information for an assembly consists of the following four values: 46 | // 47 | // Major Version 48 | // Minor Version 49 | // Build Number 50 | // Revision 51 | // 52 | // You can specify all the values or you can default the Build and Revision Numbers 53 | // by using the '*' as shown below: 54 | // [assembly: AssemblyVersion("1.0.*")] 55 | [assembly: AssemblyVersion("1.0.0.0")] 56 | [assembly: AssemblyFileVersion("1.0.0.0")] 57 | -------------------------------------------------------------------------------- /LibertyV/Utils/StreamExtension.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.IO; 26 | 27 | namespace LibertyV.Utils 28 | { 29 | static class StreamExtension 30 | { 31 | public static int CopyToCount(this Stream stream, Stream output, int count, IProgressReport writingProgress = null) 32 | { 33 | if (writingProgress != null) 34 | { 35 | writingProgress = new SubProgressReport(writingProgress, count); 36 | } 37 | byte[] buffer = new byte[32768]; 38 | int start_count = count; 39 | int read = buffer.Length; 40 | int wrote = 0; 41 | if (read > count) 42 | { 43 | read = count; 44 | } 45 | while (read > 0 && (read = stream.Read(buffer, 0, read)) > 0) 46 | { 47 | output.Write(buffer, 0, read); 48 | if (writingProgress != null) 49 | { 50 | if (writingProgress.IsCanceled()) 51 | { 52 | throw new OperationCanceledException(); 53 | } 54 | wrote += read; 55 | writingProgress.SetProgress(wrote); 56 | } 57 | count -= read; 58 | read = buffer.Length; 59 | if (read > count) 60 | { 61 | read = count; 62 | } 63 | } 64 | return start_count - count; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavcodec/dxva2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DXVA2 HW acceleration 3 | * 4 | * copyright (c) 2009 Laurent Aimar 5 | * 6 | * This file is part of Libav. 7 | * 8 | * Libav is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * Libav is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with Libav; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #ifndef AVCODEC_DXVA_H 24 | #define AVCODEC_DXVA_H 25 | 26 | /** 27 | * @file 28 | * @ingroup lavc_codec_hwaccel_dxva2 29 | * Public libavcodec DXVA2 header. 30 | */ 31 | 32 | #define _WIN32_WINNT 0x0600 33 | #include 34 | #include 35 | #include 36 | 37 | /** 38 | * @defgroup lavc_codec_hwaccel_dxva2 DXVA2 39 | * @ingroup lavc_codec_hwaccel 40 | * 41 | * @{ 42 | */ 43 | 44 | #define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards 45 | 46 | /** 47 | * This structure is used to provides the necessary configurations and data 48 | * to the DXVA2 Libav HWAccel implementation. 49 | * 50 | * The application must make it available as AVCodecContext.hwaccel_context. 51 | */ 52 | struct dxva_context { 53 | /** 54 | * DXVA2 decoder object 55 | */ 56 | IDirectXVideoDecoder *decoder; 57 | 58 | /** 59 | * DXVA2 configuration used to create the decoder 60 | */ 61 | const DXVA2_ConfigPictureDecode *cfg; 62 | 63 | /** 64 | * The number of surface in the surface array 65 | */ 66 | unsigned surface_count; 67 | 68 | /** 69 | * The array of Direct3D surfaces used to create the decoder 70 | */ 71 | LPDIRECT3DSURFACE9 *surface; 72 | 73 | /** 74 | * A bit field configuring the workarounds needed for using the decoder 75 | */ 76 | uint64_t workaround; 77 | 78 | /** 79 | * Private to the Libav AVHWAccel implementation 80 | */ 81 | unsigned report_id; 82 | }; 83 | 84 | /** 85 | * @} 86 | */ 87 | 88 | #endif /* AVCODEC_DXVA_H */ 89 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/blowfish.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Blowfish algorithm 3 | * 4 | * This file is part of Libav. 5 | * 6 | * Libav is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * Libav is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with Libav; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_BLOWFISH_H 22 | #define AVUTIL_BLOWFISH_H 23 | 24 | #include 25 | 26 | /** 27 | * @defgroup lavu_blowfish Blowfish 28 | * @ingroup lavu_crypto 29 | * @{ 30 | */ 31 | 32 | #define AV_BF_ROUNDS 16 33 | 34 | typedef struct AVBlowfish { 35 | uint32_t p[AV_BF_ROUNDS + 2]; 36 | uint32_t s[4][256]; 37 | } AVBlowfish; 38 | 39 | /** 40 | * Initialize an AVBlowfish context. 41 | * 42 | * @param ctx an AVBlowfish context 43 | * @param key a key 44 | * @param key_len length of the key 45 | */ 46 | void av_blowfish_init(struct AVBlowfish *ctx, const uint8_t *key, int key_len); 47 | 48 | /** 49 | * Encrypt or decrypt a buffer using a previously initialized context. 50 | * 51 | * @param ctx an AVBlowfish context 52 | * @param xl left four bytes halves of input to be encrypted 53 | * @param xr right four bytes halves of input to be encrypted 54 | * @param decrypt 0 for encryption, 1 for decryption 55 | */ 56 | void av_blowfish_crypt_ecb(struct AVBlowfish *ctx, uint32_t *xl, uint32_t *xr, 57 | int decrypt); 58 | 59 | /** 60 | * Encrypt or decrypt a buffer using a previously initialized context. 61 | * 62 | * @param ctx an AVBlowfish context 63 | * @param dst destination array, can be equal to src 64 | * @param src source array, can be equal to dst 65 | * @param count number of 8 byte blocks 66 | * @param iv initialization vector for CBC mode, if NULL ECB will be used 67 | * @param decrypt 0 for encryption, 1 for decryption 68 | */ 69 | void av_blowfish_crypt(struct AVBlowfish *ctx, uint8_t *dst, const uint8_t *src, 70 | int count, uint8_t *iv, int decrypt); 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | #endif /* AVUTIL_BLOWFISH_H */ 77 | -------------------------------------------------------------------------------- /LibertyV/Utils/GUI.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.Windows.Forms; 26 | 27 | namespace LibertyV.Utils 28 | { 29 | public static class GUI 30 | { 31 | public static string FolderSelection(string title = null) 32 | { 33 | 34 | FolderSelectDialog folderBrowserDialog = new FolderSelectDialog(); 35 | if (folderBrowserDialog.ShowDialog()) 36 | { 37 | return folderBrowserDialog.FileName; 38 | } 39 | return null; 40 | } 41 | 42 | public static string FileSelection(string title = null, string filter = null) { 43 | OpenFileDialog openFileDialog = new OpenFileDialog(); 44 | if (title != null) 45 | { 46 | openFileDialog.Title = title; 47 | } 48 | if (filter != null) 49 | { 50 | openFileDialog.Filter = filter; 51 | } 52 | if (openFileDialog.ShowDialog() == DialogResult.OK) 53 | { 54 | return openFileDialog.FileName; 55 | } 56 | return null; 57 | } 58 | 59 | public static string FileSaveSelection(string filename = null) { 60 | SaveFileDialog saveFileDialog = new SaveFileDialog(); 61 | if (filename != null) 62 | { 63 | saveFileDialog.FileName = filename; 64 | } 65 | if (saveFileDialog.ShowDialog() == DialogResult.OK) 66 | { 67 | return saveFileDialog.FileName; 68 | } 69 | return null; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /LibertyV/PlatformSelection.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.ComponentModel; 24 | using System.Data; 25 | using System.Drawing; 26 | using System.Linq; 27 | using System.Text; 28 | using System.Windows.Forms; 29 | using LibertyV.Utils; 30 | using System.IO; 31 | 32 | namespace LibertyV 33 | { 34 | public partial class PlatformSelection : Form 35 | { 36 | public PlatformSelection() 37 | { 38 | InitializeComponent(); 39 | UpdatePlatformButtons(); 40 | } 41 | 42 | private void UpdatePlatformButtons() 43 | { 44 | xboxSelect.Enabled = Properties.Settings.Default.Xbox360KeyFileEnabled; 45 | playstationSelect.Enabled = Properties.Settings.Default.PS3KeyFileEnabled; 46 | } 47 | 48 | private void xboxSelect_Click(object sender, EventArgs e) 49 | { 50 | GlobalOptions.Platform = Platform.PlatformType.XBOX360; 51 | AES.Key = File.ReadAllBytes(Path.Combine(Program.GetApplicationDirectory(), Properties.Settings.Default.Xbox360KeyFile)); 52 | Close(); 53 | } 54 | 55 | private void playstationSelect_Click(object sender, EventArgs e) 56 | { 57 | GlobalOptions.Platform = Platform.PlatformType.PLAYSTATION3; 58 | AES.Key = File.ReadAllBytes(Path.Combine(Program.GetApplicationDirectory(), Properties.Settings.Default.PS3KeyFile)); 59 | Close(); 60 | } 61 | 62 | private void closeButton_Click(object sender, EventArgs e) 63 | { 64 | Close(); 65 | } 66 | 67 | private void settingsButton_Click(object sender, EventArgs e) 68 | { 69 | new Settings.Settings().ShowDialog(); 70 | UpdatePlatformButtons(); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /lzx/lzx.h: -------------------------------------------------------------------------------- 1 | /* $Id: lzx.h 6 2008-10-14 23:15:30Z lenik $ */ 2 | /*************************************************************************** 3 | * lzx.h - LZX decompression routines * 4 | * ------------------- * 5 | * * 6 | * maintainer: Jed Wing * 7 | * source: modified lzx.c from cabextract v0.5 * 8 | * notes: This file was taken from cabextract v0.5, which was, * 9 | * itself, a modified version of the lzx decompression code * 10 | * from unlzx. * 11 | ***************************************************************************/ 12 | 13 | /*************************************************************************** 14 | * * 15 | * This program is free software; you can redistribute it and/or modify * 16 | * it under the terms of the GNU General Public License as published by * 17 | * the Free Software Foundation; either version 2 of the License, or * 18 | * (at your option) any later version. Note that an exemption to this * 19 | * license has been granted by Stuart Caie for the purposes of * 20 | * distribution with chmlib. This does not, to the best of my * 21 | * knowledge, constitute a change in the license of this (the LZX) code * 22 | * in general. * 23 | * * 24 | ***************************************************************************/ 25 | 26 | #ifndef INCLUDED_LZX_H 27 | #define INCLUDED_LZX_H 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | /* return codes */ 34 | #define DECR_OK (0) 35 | #define DECR_DATAFORMAT (1) 36 | #define DECR_ILLEGALDATA (2) 37 | #define DECR_NOMEMORY (3) 38 | 39 | /* opaque state structure */ 40 | struct LZXstate; 41 | 42 | /* create an lzx state object */ 43 | __declspec(dllexport) struct LZXstate *LZXinit(int window); 44 | 45 | /* destroy an lzx state object */ 46 | __declspec(dllexport) void LZXteardown(struct LZXstate *pState); 47 | 48 | /* reset an lzx stream */ 49 | __declspec(dllexport) int LZXreset(struct LZXstate *pState); 50 | 51 | /* decompress an LZX compressed block */ 52 | __declspec(dllexport) int LZXdecompress(struct LZXstate *pState, 53 | unsigned char *inpos, 54 | unsigned char *outpos, 55 | int inlen, 56 | int outlen); 57 | 58 | #ifdef __cplusplus 59 | } 60 | #endif 61 | 62 | #endif /* INCLUDED_LZX_H */ 63 | -------------------------------------------------------------------------------- /LibertyV/Utils/SubProgressReport.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | 26 | namespace LibertyV.Utils 27 | { 28 | class SubProgressReport : IProgressReport 29 | { 30 | private float StartProgress; 31 | private float ProgressLength; 32 | private long FullValue; 33 | private float Unit; 34 | private IProgressReport Parent; 35 | 36 | public SubProgressReport(IProgressReport report, long startProgress, long progress = 1, long units = 100) 37 | { 38 | StartProgress = startProgress; 39 | ProgressLength = progress; 40 | FullValue = units; 41 | 42 | // No need to while, because the parent of a subprogressreport can't be subprogressreport 43 | if (report is SubProgressReport) 44 | { 45 | StartProgress *= ((SubProgressReport)report).Unit; 46 | StartProgress += ((SubProgressReport)report).StartProgress; 47 | ProgressLength *= ((SubProgressReport)report).Unit; 48 | report = ((SubProgressReport)report).Parent; 49 | } 50 | 51 | Parent = report; 52 | Unit = ProgressLength / units; 53 | } 54 | 55 | public SubProgressReport(IProgressReport report, long units = 100) 56 | : this(report, 0, report.GetFullValue(), units) 57 | { 58 | } 59 | 60 | public void SetProgress(long value) 61 | { 62 | Parent.SetProgress((long)(StartProgress + value * Unit)); 63 | } 64 | 65 | public void SetMessage(string message) 66 | { 67 | Parent.SetMessage(message); 68 | } 69 | 70 | public bool IsCanceled() 71 | { 72 | return Parent.IsCanceled(); 73 | } 74 | 75 | public long GetFullValue() 76 | { 77 | return FullValue; 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/crc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of Libav. 5 | * 6 | * Libav is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * Libav is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with Libav; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_CRC_H 22 | #define AVUTIL_CRC_H 23 | 24 | #include 25 | #include 26 | #include "attributes.h" 27 | 28 | typedef uint32_t AVCRC; 29 | 30 | typedef enum { 31 | AV_CRC_8_ATM, 32 | AV_CRC_16_ANSI, 33 | AV_CRC_16_CCITT, 34 | AV_CRC_32_IEEE, 35 | AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ 36 | AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ 37 | }AVCRCId; 38 | 39 | /** 40 | * Initialize a CRC table. 41 | * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024 42 | * @param le If 1, the lowest bit represents the coefficient for the highest 43 | * exponent of the corresponding polynomial (both for poly and 44 | * actual CRC). 45 | * If 0, you must swap the CRC parameter and the result of av_crc 46 | * if you need the standard representation (can be simplified in 47 | * most cases to e.g. bswap16): 48 | * av_bswap32(crc << (32-bits)) 49 | * @param bits number of bits for the CRC 50 | * @param poly generator polynomial without the x**bits coefficient, in the 51 | * representation as specified by le 52 | * @param ctx_size size of ctx in bytes 53 | * @return <0 on failure 54 | */ 55 | int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); 56 | 57 | /** 58 | * Get an initialized standard CRC table. 59 | * @param crc_id ID of a standard CRC 60 | * @return a pointer to the CRC table or NULL on failure 61 | */ 62 | const AVCRC *av_crc_get_table(AVCRCId crc_id); 63 | 64 | /** 65 | * Calculate the CRC of a block. 66 | * @param crc CRC of previous blocks if any or initial value for CRC 67 | * @return CRC updated with the data from the given block 68 | * 69 | * @see av_crc_init() "le" parameter 70 | */ 71 | uint32_t av_crc(const AVCRC *ctx, uint32_t crc, 72 | const uint8_t *buffer, size_t length) av_pure; 73 | 74 | #endif /* AVUTIL_CRC_H */ 75 | -------------------------------------------------------------------------------- /LibertyV/Rage/RPF/V7/Entries/RegularFileEntry.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.IO; 26 | using LibertyV.Utils; 27 | 28 | namespace LibertyV.Rage.RPF.V7.Entries 29 | { 30 | public class RegularFileEntry : FileEntry 31 | { 32 | public bool Compressed; 33 | 34 | public RegularFileEntry(String filename, IStreamCreator data, bool compressed) 35 | : base(filename, data) 36 | { 37 | this.Compressed = compressed; 38 | } 39 | 40 | public override FileStreamCreator TryGetOriginalFileStreamCreator() 41 | { 42 | if (this.Compressed && this.Data.GetType() == typeof(CompressedFileStreamCreator)) 43 | { 44 | return (this.Data as CompressedFileStreamCreator); 45 | } 46 | else if (!this.Compressed && this.Data.GetType() == typeof(FileStreamCreator)) 47 | { 48 | return (this.Data as FileStreamCreator); 49 | } 50 | return null; 51 | } 52 | 53 | public override void Write(Stream stream) 54 | { 55 | FileStreamCreator originalStream = this.TryGetOriginalFileStreamCreator(); 56 | // optimization: Check if we have the data from the original file, and we don't need to encrypt and compress it again 57 | if (originalStream != null) 58 | { 59 | originalStream.WriteRaw(stream); 60 | } 61 | else 62 | { 63 | // we need to create it.. 64 | Stream baseStream = new StreamKeeper(stream); 65 | using (Stream input = this.Data.GetStream()) 66 | { 67 | using (Stream output = this.Compressed ? Platform.GetCompressStream(AES.EncryptStream(baseStream)) : baseStream) 68 | { 69 | input.CopyTo(output); 70 | } 71 | } 72 | } 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /LibertyV/Program.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Windows.Forms; 25 | using System.IO; 26 | using LibertyV.Utils; 27 | using LibertyV.Rage.RPF.V7; 28 | 29 | namespace LibertyV 30 | { 31 | static class Program 32 | { 33 | /// 34 | /// The main entry point for the application. 35 | /// 36 | [STAThread] 37 | static void Main(string[] args) 38 | { 39 | Application.EnableVisualStyles(); 40 | Application.SetCompatibleTextRenderingDefault(false); 41 | 42 | // Set the configuration by the validity of the keys 43 | Properties.Settings.Default.Xbox360KeyFileEnabled = Settings.Settings.CheckXbox360Key(Path.Combine(GetApplicationDirectory(), Properties.Settings.Default.Xbox360KeyFile)); 44 | Properties.Settings.Default.PS3KeyFileEnabled = Settings.Settings.CheckPS3Key(Path.Combine(GetApplicationDirectory(), Properties.Settings.Default.PS3KeyFile)); 45 | 46 | new PlatformSelection().ShowDialog(); 47 | 48 | if (GlobalOptions.Platform == Platform.PlatformType.NONE) 49 | { 50 | return; 51 | } 52 | 53 | string filename = null; 54 | foreach (string s in args) 55 | { 56 | // For future command-line support, right now ignore them 57 | if (!s.StartsWith("-")) 58 | { 59 | filename = s; 60 | break; 61 | } 62 | } 63 | 64 | if (filename != null) 65 | { 66 | Application.Run(new LibertyV(filename)); 67 | } 68 | else 69 | { 70 | Application.Run(new LibertyV()); 71 | } 72 | } 73 | 74 | public static string GetApplicationDirectory() 75 | { 76 | return System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /LibertyV/Utils/StreamKeeper.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.IO; 26 | 27 | namespace LibertyV.Utils 28 | { 29 | // The point of this class, is not to close the stream on dispose 30 | class StreamKeeper : Stream 31 | { 32 | private Stream _stream; 33 | 34 | public StreamKeeper(Stream stream) 35 | { 36 | _stream = stream; 37 | } 38 | 39 | public override bool CanRead 40 | { 41 | get { return _stream.CanRead; } 42 | } 43 | 44 | public override bool CanSeek 45 | { 46 | get { return _stream.CanSeek; } 47 | } 48 | 49 | public override bool CanWrite 50 | { 51 | get { return _stream.CanWrite; } 52 | } 53 | 54 | public override long Length 55 | { 56 | get { return _stream.Length; } 57 | } 58 | 59 | public override long Position 60 | { 61 | get { return _stream.Position; } 62 | set { _stream.Position = value; } 63 | } 64 | 65 | public override void Flush() 66 | { 67 | _stream.Flush(); 68 | } 69 | 70 | public override long Seek(long offset, SeekOrigin origin) 71 | { 72 | return _stream.Seek(offset, origin); 73 | } 74 | 75 | public override void SetLength(long value) 76 | { 77 | _stream.SetLength(value); 78 | } 79 | 80 | public override int Read(byte[] buffer, int offset, int count) 81 | { 82 | return _stream.Read(buffer, offset, count); 83 | } 84 | 85 | public override void Write(byte[] buffer, int offset, int count) 86 | { 87 | _stream.Write(buffer, offset, count); 88 | } 89 | 90 | protected override void Dispose(bool disposing) 91 | { 92 | // Don't do anything, we want to keep the stream open 93 | _stream = null; 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavcodec/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * This file is part of Libav. 4 | * 5 | * Libav is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * Libav is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with Libav; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef AVCODEC_VERSION_H 21 | #define AVCODEC_VERSION_H 22 | 23 | /** 24 | * @file 25 | * @ingroup libavc 26 | * Libavcodec version macros. 27 | */ 28 | 29 | #define LIBAVCODEC_VERSION_MAJOR 55 30 | #define LIBAVCODEC_VERSION_MINOR 21 31 | #define LIBAVCODEC_VERSION_MICRO 0 32 | 33 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ 34 | LIBAVCODEC_VERSION_MINOR, \ 35 | LIBAVCODEC_VERSION_MICRO) 36 | #define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ 37 | LIBAVCODEC_VERSION_MINOR, \ 38 | LIBAVCODEC_VERSION_MICRO) 39 | #define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT 40 | 41 | #define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) 42 | 43 | /** 44 | * FF_API_* defines may be placed below to indicate public API that will be 45 | * dropped at a future version bump. The defines themselves are not part of 46 | * the public API and may change, break or disappear at any time. 47 | */ 48 | 49 | #ifndef FF_API_REQUEST_CHANNELS 50 | #define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 56) 51 | #endif 52 | #ifndef FF_API_DEINTERLACE 53 | #define FF_API_DEINTERLACE (LIBAVCODEC_VERSION_MAJOR < 56) 54 | #endif 55 | #ifndef FF_API_DESTRUCT_PACKET 56 | #define FF_API_DESTRUCT_PACKET (LIBAVCODEC_VERSION_MAJOR < 56) 57 | #endif 58 | #ifndef FF_API_GET_BUFFER 59 | #define FF_API_GET_BUFFER (LIBAVCODEC_VERSION_MAJOR < 56) 60 | #endif 61 | #ifndef FF_API_MISSING_SAMPLE 62 | #define FF_API_MISSING_SAMPLE (LIBAVCODEC_VERSION_MAJOR < 56) 63 | #endif 64 | #ifndef FF_API_LOWRES 65 | #define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 56) 66 | #endif 67 | #ifndef FF_API_CAP_VDPAU 68 | #define FF_API_CAP_VDPAU (LIBAVCODEC_VERSION_MAJOR < 56) 69 | #endif 70 | #ifndef FF_API_BUFS_VDPAU 71 | #define FF_API_BUFS_VDPAU (LIBAVCODEC_VERSION_MAJOR < 56) 72 | #endif 73 | #ifndef FF_API_VOXWARE 74 | #define FF_API_VOXWARE (LIBAVCODEC_VERSION_MAJOR < 56) 75 | #endif 76 | 77 | #endif /* AVCODEC_VERSION_H */ 78 | -------------------------------------------------------------------------------- /LibertyV/Rage/Audio/AWC/SplittedAudio.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.IO; 26 | using LibertyV.Utils; 27 | 28 | namespace LibertyV.Rage.Audio.AWC 29 | { 30 | class SplittedAudio : IAudio 31 | { 32 | List Streams; 33 | List> StreamsSamples; 34 | uint Samples; 35 | int SamplesPerSecond; 36 | 37 | public SplittedAudio(List streams, List> streamsSamples, uint samples, int samplesPerSecond) 38 | { 39 | this.Samples = samples; 40 | this.SamplesPerSecond = samplesPerSecond; 41 | this.StreamsSamples = streamsSamples; 42 | Streams = streams; 43 | } 44 | 45 | public int GetBits() 46 | { 47 | return GlobalOptions.AudioBits; 48 | } 49 | 50 | public uint GetSamplesCount() 51 | { 52 | return Samples; 53 | } 54 | 55 | public int GetSamplesPerSecond() 56 | { 57 | return SamplesPerSecond; 58 | } 59 | 60 | public int GetChannels() 61 | { 62 | return 1; 63 | } 64 | 65 | public int GetSize() 66 | { 67 | return (int)((this.GetBits() / 8) * this.GetChannels() * this.GetSamplesCount()); 68 | } 69 | 70 | public Stream GetPCMStream() 71 | { 72 | // At first I made a decoder for each stream. But the problem is that mp3 is stateful, so I did something ugly. 73 | SplittedAudioPCMStream stream = new SplittedAudioPCMStream(this.Streams.Select(_stream => new PartialStream(_stream, 0, _stream.Length)).ToList(), this.StreamsSamples, this.GetChannels(), this.GetBits()); 74 | stream.SetDecoderStream(Audio.GetCodecStream(stream.GetRawReadStream())); 75 | return stream; 76 | } 77 | 78 | public void Dispose() 79 | { 80 | foreach (Stream stream in Streams) 81 | { 82 | stream.Dispose(); 83 | } 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Build results 10 | 11 | [Dd]ebug/ 12 | [Rr]elease/ 13 | x64/ 14 | build/ 15 | [Bb]in/ 16 | [Oo]bj/ 17 | 18 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 19 | !packages/*/build/ 20 | 21 | # MSTest test Results 22 | [Tt]est[Rr]esult*/ 23 | [Bb]uild[Ll]og.* 24 | 25 | *_i.c 26 | *_p.c 27 | *.ilk 28 | *.meta 29 | *.obj 30 | *.pch 31 | *.pdb 32 | *.pgc 33 | *.pgd 34 | *.rsp 35 | *.sbr 36 | *.tlb 37 | *.tli 38 | *.tlh 39 | *.tmp 40 | *.tmp_proj 41 | *.log 42 | *.vspscc 43 | *.vssscc 44 | .builds 45 | *.pidb 46 | *.log 47 | *.scc 48 | 49 | # Visual C++ cache files 50 | ipch/ 51 | *.aps 52 | *.ncb 53 | *.opensdf 54 | *.sdf 55 | *.cachefile 56 | 57 | # Visual Studio profiler 58 | *.psess 59 | *.vsp 60 | *.vspx 61 | 62 | # Guidance Automation Toolkit 63 | *.gpState 64 | 65 | # ReSharper is a .NET coding add-in 66 | _ReSharper*/ 67 | *.[Rr]e[Ss]harper 68 | 69 | # TeamCity is a build add-in 70 | _TeamCity* 71 | 72 | # DotCover is a Code Coverage Tool 73 | *.dotCover 74 | 75 | # NCrunch 76 | *.ncrunch* 77 | .*crunch*.local.xml 78 | 79 | # Installshield output folder 80 | [Ee]xpress/ 81 | 82 | # DocProject is a documentation generator add-in 83 | DocProject/buildhelp/ 84 | DocProject/Help/*.HxT 85 | DocProject/Help/*.HxC 86 | DocProject/Help/*.hhc 87 | DocProject/Help/*.hhk 88 | DocProject/Help/*.hhp 89 | DocProject/Help/Html2 90 | DocProject/Help/html 91 | 92 | # Click-Once directory 93 | publish/ 94 | 95 | # Publish Web Output 96 | *.Publish.xml 97 | *.pubxml 98 | 99 | # NuGet Packages Directory 100 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 101 | #packages/ 102 | 103 | # Windows Azure Build Output 104 | csx 105 | *.build.csdef 106 | 107 | # Windows Store app package directory 108 | AppPackages/ 109 | 110 | # Others 111 | sql/ 112 | *.Cache 113 | ClientBin/ 114 | [Ss]tyle[Cc]op.* 115 | ~$* 116 | *~ 117 | *.dbmdl 118 | *.[Pp]ublish.xml 119 | *.pfx 120 | *.publishsettings 121 | 122 | # RIA/Silverlight projects 123 | Generated_Code/ 124 | 125 | # Backup & report files from converting an old project file to a newer 126 | # Visual Studio version. Backup files are not needed, because we have git ;-) 127 | _UpgradeReport_Files/ 128 | Backup*/ 129 | UpgradeLog*.XML 130 | UpgradeLog*.htm 131 | 132 | # SQL Server files 133 | App_Data/*.mdf 134 | App_Data/*.ldf 135 | 136 | # ========================= 137 | # Windows detritus 138 | # ========================= 139 | 140 | # Windows image file caches 141 | Thumbs.db 142 | ehthumbs.db 143 | 144 | # Folder config file 145 | Desktop.ini 146 | 147 | # Recycle Bin used on file shares 148 | $RECYCLE.BIN/ 149 | 150 | # Mac crap 151 | .DS_Store -------------------------------------------------------------------------------- /LibertyV/Operations/OperationMenuItem.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.Windows.Forms; 26 | 27 | namespace LibertyV.Operations 28 | { 29 | class OperationMenuItem : IMenuItem 30 | { 31 | public OperationMenuItem(string text, Action operationFunction, Keys keyboardShortcut, bool isDefault, Func conditionFunction, bool hideIfDisabled) 32 | { 33 | this.Text = text; 34 | this.Operation = operationFunction; 35 | this.KeyboardShortcut = keyboardShortcut; 36 | this.IsDefault = isDefault; 37 | this.CheckCondition = conditionFunction; 38 | this.HideIfDisabled = hideIfDisabled; 39 | } 40 | 41 | private string Text; 42 | private Action Operation; 43 | private Keys KeyboardShortcut; 44 | private bool IsDefault; 45 | private Func CheckCondition; 46 | private bool HideIfDisabled; 47 | 48 | public ToolStripItem[] GetContextMenuItems(T obj) 49 | { 50 | bool cond = CheckCondition(obj); 51 | if (cond || !HideIfDisabled) 52 | { 53 | ToolStripMenuItem item = new ToolStripMenuItem(Text, null, new EventHandler(delegate(Object o, EventArgs a) 54 | { 55 | Operation(obj); 56 | }), KeyboardShortcut); 57 | if (!cond) { 58 | item.Enabled = false; 59 | } 60 | return new ToolStripItem[] { item }; 61 | } 62 | return new ToolStripItem[] { }; 63 | } 64 | 65 | public Action GetDefaultAction(T obj) 66 | { 67 | if (CheckCondition(obj) && IsDefault) 68 | { 69 | return Operation; 70 | } 71 | return null; 72 | } 73 | 74 | public Action GetActionByKey(Keys key, T obj) 75 | { 76 | if (CheckCondition(obj) && KeyboardShortcut != Keys.None && KeyboardShortcut == key) 77 | { 78 | return Operation; 79 | } 80 | return null; 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/hmac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Martin Storsjo 3 | * 4 | * This file is part of Libav. 5 | * 6 | * Libav is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * Libav is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with Libav; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_HMAC_H 22 | #define AVUTIL_HMAC_H 23 | 24 | #include 25 | 26 | /** 27 | * @defgroup lavu_hmac HMAC 28 | * @ingroup lavu_crypto 29 | * @{ 30 | */ 31 | 32 | enum AVHMACType { 33 | AV_HMAC_MD5, 34 | AV_HMAC_SHA1, 35 | }; 36 | 37 | typedef struct AVHMAC AVHMAC; 38 | 39 | /** 40 | * Allocate an AVHMAC context. 41 | * @param type The hash function used for the HMAC. 42 | */ 43 | AVHMAC *av_hmac_alloc(enum AVHMACType type); 44 | 45 | /** 46 | * Free an AVHMAC context. 47 | * @param ctx The context to free, may be NULL 48 | */ 49 | void av_hmac_free(AVHMAC *ctx); 50 | 51 | /** 52 | * Initialize an AVHMAC context with an authentication key. 53 | * @param ctx The HMAC context 54 | * @param key The authentication key 55 | * @param keylen The length of the key, in bytes 56 | */ 57 | void av_hmac_init(AVHMAC *ctx, const uint8_t *key, unsigned int keylen); 58 | 59 | /** 60 | * Hash data with the HMAC. 61 | * @param ctx The HMAC context 62 | * @param data The data to hash 63 | * @param len The length of the data, in bytes 64 | */ 65 | void av_hmac_update(AVHMAC *ctx, const uint8_t *data, unsigned int len); 66 | 67 | /** 68 | * Finish hashing and output the HMAC digest. 69 | * @param ctx The HMAC context 70 | * @param out The output buffer to write the digest into 71 | * @param outlen The length of the out buffer, in bytes 72 | * @return The number of bytes written to out, or a negative error code. 73 | */ 74 | int av_hmac_final(AVHMAC *ctx, uint8_t *out, unsigned int outlen); 75 | 76 | /** 77 | * Hash an array of data with a key. 78 | * @param ctx The HMAC context 79 | * @param data The data to hash 80 | * @param len The length of the data, in bytes 81 | * @param key The authentication key 82 | * @param keylen The length of the key, in bytes 83 | * @param out The output buffer to write the digest into 84 | * @param outlen The length of the out buffer, in bytes 85 | * @return The number of bytes written to out, or a negative error code. 86 | */ 87 | int av_hmac_calc(AVHMAC *ctx, const uint8_t *data, unsigned int len, 88 | const uint8_t *key, unsigned int keylen, 89 | uint8_t *out, unsigned int outlen); 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | #endif /* AVUTIL_HMAC_H */ 96 | -------------------------------------------------------------------------------- /LibertyV/Operations/MenuItemsList.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.Windows.Forms; 26 | 27 | namespace LibertyV.Operations 28 | { 29 | class MenuItemsList : List>, IMenuItem 30 | { 31 | public void Add(string text, Action operationFunction, Keys keyboardShortcut = Keys.None, bool isDefault = false, Func conditionFunction = null, bool hideIfDisabled = true) 32 | { 33 | if (conditionFunction == null) 34 | { 35 | conditionFunction = delegate(T obj) { return true; }; 36 | } 37 | Add(new OperationMenuItem(text, operationFunction, keyboardShortcut, isDefault, conditionFunction, hideIfDisabled)); 38 | } 39 | 40 | public void Add(string name, MenuItemsList submenu) 41 | { 42 | Add(new SubMenuItem(name, submenu)); 43 | } 44 | 45 | public void Add(Operations.SeperatorClass obj) 46 | { 47 | Add(new SeperatorMenuItem()); 48 | } 49 | 50 | public ToolStripItem[] GetContextMenuItems(T obj) 51 | { 52 | List items = new List(); 53 | foreach (IMenuItem item in this) 54 | { 55 | items.AddRange(item.GetContextMenuItems(obj)); 56 | } 57 | return items.ToArray(); 58 | } 59 | 60 | public Action GetDefaultAction(T obj) 61 | { 62 | foreach (IMenuItem item in this) 63 | { 64 | Action res = item.GetDefaultAction(obj); 65 | if (res != null) 66 | { 67 | return res; 68 | } 69 | } 70 | return null; 71 | } 72 | 73 | public Action GetActionByKey(Keys key, T obj) 74 | { 75 | foreach (IMenuItem item in this) 76 | { 77 | Action res = item.GetActionByKey(key, obj); 78 | if (res != null) 79 | { 80 | return res; 81 | } 82 | } 83 | return null; 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /LibertyV/Rage/RPF/V7/Entries/FileEntry.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.IO; 26 | using LibertyV.Utils; 27 | 28 | namespace LibertyV.Rage.RPF.V7.Entries 29 | { 30 | public abstract class FileEntry : Entry 31 | { 32 | public IStreamCreator Data; 33 | public EntryListViewItem ViewItem; 34 | 35 | public FileEntry(String filename, IStreamCreator data) 36 | : base(filename) 37 | { 38 | this.Data = data; 39 | } 40 | 41 | public virtual void Write(Stream stream) 42 | { 43 | using (Stream s = this.Data.GetStream()) { 44 | s.CopyTo(stream); 45 | } 46 | } 47 | 48 | public override void Export(String path, IProgressReport progress = null) 49 | { 50 | string filename; 51 | if (Directory.Exists(path)) 52 | { 53 | filename = Path.Combine(path, this.Name); 54 | } 55 | else 56 | { 57 | filename = path; 58 | } 59 | 60 | if (progress != null) 61 | { 62 | progress.SetMessage("Extracting " + this.Name + "."); 63 | } 64 | 65 | using (FileStream file = File.Create(filename)) 66 | { 67 | using (Stream stream = this.Data.GetStream()) 68 | { 69 | stream.CopyToCount(file, this.Data.GetSize(), progress); 70 | } 71 | } 72 | } 73 | 74 | public virtual FileStreamCreator TryGetOriginalFileStreamCreator() 75 | { 76 | return null; 77 | } 78 | 79 | 80 | public string GetExtension() 81 | { 82 | return Path.GetExtension(Name); 83 | } 84 | 85 | public bool IsRegularFile() 86 | { 87 | return this is RegularFileEntry; 88 | } 89 | 90 | public bool IsResource() 91 | { 92 | return this is ResourceEntry; 93 | } 94 | 95 | public override void Dispose() 96 | { 97 | Data.Dispose(); 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/bswap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of Libav. 5 | * 6 | * Libav is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * Libav is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with Libav; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * byte swapping routines 24 | */ 25 | 26 | #ifndef AVUTIL_BSWAP_H 27 | #define AVUTIL_BSWAP_H 28 | 29 | #include 30 | #include "libavutil/avconfig.h" 31 | #include "attributes.h" 32 | 33 | #ifdef HAVE_AV_CONFIG_H 34 | 35 | #include "config.h" 36 | 37 | #if ARCH_ARM 38 | # include "arm/bswap.h" 39 | #elif ARCH_AVR32 40 | # include "avr32/bswap.h" 41 | #elif ARCH_BFIN 42 | # include "bfin/bswap.h" 43 | #elif ARCH_SH4 44 | # include "sh4/bswap.h" 45 | #elif ARCH_X86 46 | # include "x86/bswap.h" 47 | #endif 48 | 49 | #endif /* HAVE_AV_CONFIG_H */ 50 | 51 | #define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff)) 52 | #define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16)) 53 | #define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C((x) >> 32)) 54 | 55 | #define AV_BSWAPC(s, x) AV_BSWAP##s##C(x) 56 | 57 | #ifndef av_bswap16 58 | static av_always_inline av_const uint16_t av_bswap16(uint16_t x) 59 | { 60 | x= (x>>8) | (x<<8); 61 | return x; 62 | } 63 | #endif 64 | 65 | #ifndef av_bswap32 66 | static av_always_inline av_const uint32_t av_bswap32(uint32_t x) 67 | { 68 | return AV_BSWAP32C(x); 69 | } 70 | #endif 71 | 72 | #ifndef av_bswap64 73 | static inline uint64_t av_const av_bswap64(uint64_t x) 74 | { 75 | return (uint64_t)av_bswap32(x) << 32 | av_bswap32(x >> 32); 76 | } 77 | #endif 78 | 79 | // be2ne ... big-endian to native-endian 80 | // le2ne ... little-endian to native-endian 81 | 82 | #if AV_HAVE_BIGENDIAN 83 | #define av_be2ne16(x) (x) 84 | #define av_be2ne32(x) (x) 85 | #define av_be2ne64(x) (x) 86 | #define av_le2ne16(x) av_bswap16(x) 87 | #define av_le2ne32(x) av_bswap32(x) 88 | #define av_le2ne64(x) av_bswap64(x) 89 | #define AV_BE2NEC(s, x) (x) 90 | #define AV_LE2NEC(s, x) AV_BSWAPC(s, x) 91 | #else 92 | #define av_be2ne16(x) av_bswap16(x) 93 | #define av_be2ne32(x) av_bswap32(x) 94 | #define av_be2ne64(x) av_bswap64(x) 95 | #define av_le2ne16(x) (x) 96 | #define av_le2ne32(x) (x) 97 | #define av_le2ne64(x) (x) 98 | #define AV_BE2NEC(s, x) AV_BSWAPC(s, x) 99 | #define AV_LE2NEC(s, x) (x) 100 | #endif 101 | 102 | #define AV_BE2NE16C(x) AV_BE2NEC(16, x) 103 | #define AV_BE2NE32C(x) AV_BE2NEC(32, x) 104 | #define AV_BE2NE64C(x) AV_BE2NEC(64, x) 105 | #define AV_LE2NE16C(x) AV_LE2NEC(16, x) 106 | #define AV_LE2NE32C(x) AV_LE2NEC(32, x) 107 | #define AV_LE2NE64C(x) AV_LE2NEC(64, x) 108 | 109 | #endif /* AVUTIL_BSWAP_H */ 110 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Libav. 3 | * 4 | * Libav is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * Libav is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with Libav; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVUTIL_VERSION_H 20 | #define AVUTIL_VERSION_H 21 | 22 | #include "avutil.h" 23 | 24 | /** 25 | * @file 26 | * @ingroup lavu 27 | * Libavutil version macros 28 | */ 29 | 30 | /** 31 | * @defgroup lavu_ver Version and Build diagnostics 32 | * 33 | * Macros and function useful to check at compiletime and at runtime 34 | * which version of libavutil is in use. 35 | * 36 | * @{ 37 | */ 38 | 39 | #define LIBAVUTIL_VERSION_MAJOR 52 40 | #define LIBAVUTIL_VERSION_MINOR 16 41 | #define LIBAVUTIL_VERSION_MICRO 0 42 | 43 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ 44 | LIBAVUTIL_VERSION_MINOR, \ 45 | LIBAVUTIL_VERSION_MICRO) 46 | #define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \ 47 | LIBAVUTIL_VERSION_MINOR, \ 48 | LIBAVUTIL_VERSION_MICRO) 49 | #define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT 50 | 51 | #define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) 52 | 53 | /** 54 | * @} 55 | * 56 | * @defgroup depr_guards Deprecation guards 57 | * FF_API_* defines may be placed below to indicate public API that will be 58 | * dropped at a future version bump. The defines themselves are not part of 59 | * the public API and may change, break or disappear at any time. 60 | * 61 | * @{ 62 | */ 63 | 64 | #ifndef FF_API_PIX_FMT 65 | #define FF_API_PIX_FMT (LIBAVUTIL_VERSION_MAJOR < 53) 66 | #endif 67 | #ifndef FF_API_CONTEXT_SIZE 68 | #define FF_API_CONTEXT_SIZE (LIBAVUTIL_VERSION_MAJOR < 53) 69 | #endif 70 | #ifndef FF_API_PIX_FMT_DESC 71 | #define FF_API_PIX_FMT_DESC (LIBAVUTIL_VERSION_MAJOR < 53) 72 | #endif 73 | #ifndef FF_API_AV_REVERSE 74 | #define FF_API_AV_REVERSE (LIBAVUTIL_VERSION_MAJOR < 53) 75 | #endif 76 | #ifndef FF_API_AUDIOCONVERT 77 | #define FF_API_AUDIOCONVERT (LIBAVUTIL_VERSION_MAJOR < 53) 78 | #endif 79 | #ifndef FF_API_CPU_FLAG_MMX2 80 | #define FF_API_CPU_FLAG_MMX2 (LIBAVUTIL_VERSION_MAJOR < 53) 81 | #endif 82 | #ifndef FF_API_LLS_PRIVATE 83 | #define FF_API_LLS_PRIVATE (LIBAVUTIL_VERSION_MAJOR < 53) 84 | #endif 85 | #ifndef FF_API_AVFRAME_LAVC 86 | #define FF_API_AVFRAME_LAVC (LIBAVUTIL_VERSION_MAJOR < 53) 87 | #endif 88 | #ifndef FF_API_VDPAU 89 | #define FF_API_VDPAU (LIBAVUTIL_VERSION_MAJOR < 53) 90 | #endif 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | #endif /* AVUTIL_VERSION_H */ 97 | -------------------------------------------------------------------------------- /LibertyV/Operations/Delete.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using LibertyV.Rage.RPF.V7.Entries; 26 | using LibertyV.Utils; 27 | using System.Windows.Forms; 28 | 29 | namespace LibertyV.Operations 30 | { 31 | static class Delete 32 | { 33 | public static void ForceDeleteFolder(DirectoryEntry entry) 34 | { 35 | DeleteFolder(entry); 36 | } 37 | public static void ForceDeleteFile(FileEntry entry) 38 | { 39 | DeleteFile(entry); 40 | } 41 | public static void ForceDeleteFiles(ICollection entries) 42 | { 43 | DeleteFiles(entries); 44 | } 45 | 46 | public static void AskDeleteFolder(DirectoryEntry entry) 47 | { 48 | DeleteFolder(entry, false); 49 | } 50 | public static void AskDeleteFile(FileEntry entry) 51 | { 52 | DeleteFile(entry, false); 53 | } 54 | public static void AskDeleteFiles(ICollection entries) 55 | { 56 | DeleteFiles(entries, false); 57 | } 58 | 59 | public static void DeleteFolder(DirectoryEntry entry, bool force = true) 60 | { 61 | if (force || MessageBox.Show(String.Format("Are you sure you want to delete the folder '{0}'?", entry.Name), "Delete Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) 62 | { 63 | entry.Parent.RemoveEntry(entry); 64 | } 65 | } 66 | 67 | public static void DeleteFile(FileEntry entry, bool force = true) 68 | { 69 | if (force || MessageBox.Show(String.Format("Are you sure you want to delete the item '{0}'?", entry.Name), "Delete Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) 70 | { 71 | entry.Parent.RemoveEntry(entry); 72 | } 73 | } 74 | 75 | public static void DeleteFiles(ICollection entries, bool force = true) 76 | { 77 | if (force || MessageBox.Show(String.Format("Are you sure you want to delete {0} items?", entries.Count), "Delete Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) 78 | { 79 | foreach (FileEntry entry in entries) 80 | { 81 | entry.Parent.RemoveEntry(entry); 82 | } 83 | } 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/cpu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000, 2001, 2002 Fabrice Bellard 3 | * 4 | * This file is part of Libav. 5 | * 6 | * Libav is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * Libav is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with Libav; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_CPU_H 22 | #define AVUTIL_CPU_H 23 | 24 | #include "version.h" 25 | 26 | #define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ 27 | 28 | /* lower 16 bits - CPU features */ 29 | #define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX 30 | #define AV_CPU_FLAG_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext 31 | #if FF_API_CPU_FLAG_MMX2 32 | #define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext 33 | #endif 34 | #define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW 35 | #define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions 36 | #define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions 37 | #define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster 38 | #define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt 39 | #define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions 40 | #define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster 41 | #define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions 42 | #define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower 43 | #define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions 44 | #define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions 45 | #define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used 46 | #define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions 47 | #define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions 48 | #define AV_CPU_FLAG_CMOV 0x1000 ///< i686 cmov 49 | 50 | #define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard 51 | 52 | #define AV_CPU_FLAG_ARMV5TE (1 << 0) 53 | #define AV_CPU_FLAG_ARMV6 (1 << 1) 54 | #define AV_CPU_FLAG_ARMV6T2 (1 << 2) 55 | #define AV_CPU_FLAG_VFP (1 << 3) 56 | #define AV_CPU_FLAG_VFPV3 (1 << 4) 57 | #define AV_CPU_FLAG_NEON (1 << 5) 58 | 59 | /** 60 | * Return the flags which specify extensions supported by the CPU. 61 | */ 62 | int av_get_cpu_flags(void); 63 | 64 | /** 65 | * Set a mask on flags returned by av_get_cpu_flags(). 66 | * This function is mainly useful for testing. 67 | * 68 | * @warning this function is not thread safe. 69 | */ 70 | void av_set_cpu_flags_mask(int mask); 71 | 72 | /** 73 | * Parse CPU flags from a string. 74 | * 75 | * @return a combination of AV_CPU_* flags, negative on error. 76 | */ 77 | int av_parse_cpu_flags(const char *s); 78 | 79 | /** 80 | * @return the number of logical CPU cores present. 81 | */ 82 | int av_cpu_count(void); 83 | 84 | #endif /* AVUTIL_CPU_H */ 85 | -------------------------------------------------------------------------------- /LibertyV/LibertyV.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibertyV", "LibertyV.csproj", "{BC36C6B4-C7DD-44E2-949E-2EE21EA2F750}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzx", "..\lzx\lzx.vcxproj", "{B97A470C-E6E6-4D61-AA00-60643A70E8CF}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libav_wrapper", "..\libav_wrapper\libav_wrapper.vcxproj", "{E39772C4-98CF-4B25-B35C-5978AE2A2C55}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Mixed Platforms = Debug|Mixed Platforms 13 | Debug|Win32 = Debug|Win32 14 | Debug|x86 = Debug|x86 15 | Release|Mixed Platforms = Release|Mixed Platforms 16 | Release|Win32 = Release|Win32 17 | Release|x86 = Release|x86 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {BC36C6B4-C7DD-44E2-949E-2EE21EA2F750}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 21 | {BC36C6B4-C7DD-44E2-949E-2EE21EA2F750}.Debug|Mixed Platforms.Build.0 = Debug|x86 22 | {BC36C6B4-C7DD-44E2-949E-2EE21EA2F750}.Debug|Win32.ActiveCfg = Debug|x86 23 | {BC36C6B4-C7DD-44E2-949E-2EE21EA2F750}.Debug|x86.ActiveCfg = Debug|x86 24 | {BC36C6B4-C7DD-44E2-949E-2EE21EA2F750}.Debug|x86.Build.0 = Debug|x86 25 | {BC36C6B4-C7DD-44E2-949E-2EE21EA2F750}.Release|Mixed Platforms.ActiveCfg = Release|x86 26 | {BC36C6B4-C7DD-44E2-949E-2EE21EA2F750}.Release|Mixed Platforms.Build.0 = Release|x86 27 | {BC36C6B4-C7DD-44E2-949E-2EE21EA2F750}.Release|Win32.ActiveCfg = Release|x86 28 | {BC36C6B4-C7DD-44E2-949E-2EE21EA2F750}.Release|x86.ActiveCfg = Release|x86 29 | {BC36C6B4-C7DD-44E2-949E-2EE21EA2F750}.Release|x86.Build.0 = Release|x86 30 | {B97A470C-E6E6-4D61-AA00-60643A70E8CF}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 31 | {B97A470C-E6E6-4D61-AA00-60643A70E8CF}.Debug|Mixed Platforms.Build.0 = Debug|Win32 32 | {B97A470C-E6E6-4D61-AA00-60643A70E8CF}.Debug|Win32.ActiveCfg = Debug|Win32 33 | {B97A470C-E6E6-4D61-AA00-60643A70E8CF}.Debug|Win32.Build.0 = Debug|Win32 34 | {B97A470C-E6E6-4D61-AA00-60643A70E8CF}.Debug|x86.ActiveCfg = Debug|Win32 35 | {B97A470C-E6E6-4D61-AA00-60643A70E8CF}.Release|Mixed Platforms.ActiveCfg = Release|Win32 36 | {B97A470C-E6E6-4D61-AA00-60643A70E8CF}.Release|Mixed Platforms.Build.0 = Release|Win32 37 | {B97A470C-E6E6-4D61-AA00-60643A70E8CF}.Release|Win32.ActiveCfg = Release|Win32 38 | {B97A470C-E6E6-4D61-AA00-60643A70E8CF}.Release|Win32.Build.0 = Release|Win32 39 | {B97A470C-E6E6-4D61-AA00-60643A70E8CF}.Release|x86.ActiveCfg = Release|Win32 40 | {E39772C4-98CF-4B25-B35C-5978AE2A2C55}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 41 | {E39772C4-98CF-4B25-B35C-5978AE2A2C55}.Debug|Mixed Platforms.Build.0 = Debug|Win32 42 | {E39772C4-98CF-4B25-B35C-5978AE2A2C55}.Debug|Win32.ActiveCfg = Debug|Win32 43 | {E39772C4-98CF-4B25-B35C-5978AE2A2C55}.Debug|Win32.Build.0 = Debug|Win32 44 | {E39772C4-98CF-4B25-B35C-5978AE2A2C55}.Debug|x86.ActiveCfg = Debug|Win32 45 | {E39772C4-98CF-4B25-B35C-5978AE2A2C55}.Release|Mixed Platforms.ActiveCfg = Release|Win32 46 | {E39772C4-98CF-4B25-B35C-5978AE2A2C55}.Release|Mixed Platforms.Build.0 = Release|Win32 47 | {E39772C4-98CF-4B25-B35C-5978AE2A2C55}.Release|Win32.ActiveCfg = Release|Win32 48 | {E39772C4-98CF-4B25-B35C-5978AE2A2C55}.Release|Win32.Build.0 = Release|Win32 49 | {E39772C4-98CF-4B25-B35C-5978AE2A2C55}.Release|x86.ActiveCfg = Release|Win32 50 | EndGlobalSection 51 | GlobalSection(SolutionProperties) = preSolution 52 | HideSolutionNode = FALSE 53 | EndGlobalSection 54 | EndGlobal 55 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavcodec/avfft.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Libav. 3 | * 4 | * Libav is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * Libav is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with Libav; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef AVCODEC_AVFFT_H 20 | #define AVCODEC_AVFFT_H 21 | 22 | /** 23 | * @file 24 | * @ingroup lavc_fft 25 | * FFT functions 26 | */ 27 | 28 | /** 29 | * @defgroup lavc_fft FFT functions 30 | * @ingroup lavc_misc 31 | * 32 | * @{ 33 | */ 34 | 35 | typedef float FFTSample; 36 | 37 | typedef struct FFTComplex { 38 | FFTSample re, im; 39 | } FFTComplex; 40 | 41 | typedef struct FFTContext FFTContext; 42 | 43 | /** 44 | * Set up a complex FFT. 45 | * @param nbits log2 of the length of the input array 46 | * @param inverse if 0 perform the forward transform, if 1 perform the inverse 47 | */ 48 | FFTContext *av_fft_init(int nbits, int inverse); 49 | 50 | /** 51 | * Do the permutation needed BEFORE calling ff_fft_calc(). 52 | */ 53 | void av_fft_permute(FFTContext *s, FFTComplex *z); 54 | 55 | /** 56 | * Do a complex FFT with the parameters defined in av_fft_init(). The 57 | * input data must be permuted before. No 1.0/sqrt(n) normalization is done. 58 | */ 59 | void av_fft_calc(FFTContext *s, FFTComplex *z); 60 | 61 | void av_fft_end(FFTContext *s); 62 | 63 | FFTContext *av_mdct_init(int nbits, int inverse, double scale); 64 | void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); 65 | void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input); 66 | void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); 67 | void av_mdct_end(FFTContext *s); 68 | 69 | /* Real Discrete Fourier Transform */ 70 | 71 | enum RDFTransformType { 72 | DFT_R2C, 73 | IDFT_C2R, 74 | IDFT_R2C, 75 | DFT_C2R, 76 | }; 77 | 78 | typedef struct RDFTContext RDFTContext; 79 | 80 | /** 81 | * Set up a real FFT. 82 | * @param nbits log2 of the length of the input array 83 | * @param trans the type of transform 84 | */ 85 | RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans); 86 | void av_rdft_calc(RDFTContext *s, FFTSample *data); 87 | void av_rdft_end(RDFTContext *s); 88 | 89 | /* Discrete Cosine Transform */ 90 | 91 | typedef struct DCTContext DCTContext; 92 | 93 | enum DCTTransformType { 94 | DCT_II = 0, 95 | DCT_III, 96 | DCT_I, 97 | DST_I, 98 | }; 99 | 100 | /** 101 | * Set up DCT. 102 | * @param nbits size of the input array: 103 | * (1 << nbits) for DCT-II, DCT-III and DST-I 104 | * (1 << nbits) + 1 for DCT-I 105 | * 106 | * @note the first element of the input of DST-I is ignored 107 | */ 108 | DCTContext *av_dct_init(int nbits, enum DCTTransformType type); 109 | void av_dct_calc(DCTContext *s, FFTSample *data); 110 | void av_dct_end (DCTContext *s); 111 | 112 | /** 113 | * @} 114 | */ 115 | 116 | #endif /* AVCODEC_AVFFT_H */ 117 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Libav. 3 | * 4 | * Libav is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2.1 of the License, or (at your option) any later version. 8 | * 9 | * Libav is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with Libav; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /** 20 | * @file 21 | * error code definitions 22 | */ 23 | 24 | #ifndef AVUTIL_ERROR_H 25 | #define AVUTIL_ERROR_H 26 | 27 | #include 28 | #include 29 | #include "avutil.h" 30 | 31 | /** 32 | * @addtogroup lavu_error 33 | * 34 | * @{ 35 | */ 36 | 37 | 38 | /* error handling */ 39 | #if EDOM > 0 40 | #define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions. 41 | #define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value. 42 | #else 43 | /* Some platforms have E* and errno already negated. */ 44 | #define AVERROR(e) (e) 45 | #define AVUNERROR(e) (e) 46 | #endif 47 | 48 | #define AVERROR_BSF_NOT_FOUND (-0x39acbd08) ///< Bitstream filter not found 49 | #define AVERROR_DECODER_NOT_FOUND (-0x3cbabb08) ///< Decoder not found 50 | #define AVERROR_DEMUXER_NOT_FOUND (-0x32babb08) ///< Demuxer not found 51 | #define AVERROR_ENCODER_NOT_FOUND (-0x3cb1ba08) ///< Encoder not found 52 | #define AVERROR_EOF (-0x5fb9b0bb) ///< End of file 53 | #define AVERROR_EXIT (-0x2bb6a7bb) ///< Immediate exit was requested; the called function should not be restarted 54 | #define AVERROR_FILTER_NOT_FOUND (-0x33b6b908) ///< Filter not found 55 | #define AVERROR_INVALIDDATA (-0x3ebbb1b7) ///< Invalid data found when processing input 56 | #define AVERROR_MUXER_NOT_FOUND (-0x27aab208) ///< Muxer not found 57 | #define AVERROR_OPTION_NOT_FOUND (-0x2bafb008) ///< Option not found 58 | #define AVERROR_PATCHWELCOME (-0x3aa8beb0) ///< Not yet implemented in Libav, patches welcome 59 | #define AVERROR_PROTOCOL_NOT_FOUND (-0x30adaf08) ///< Protocol not found 60 | #define AVERROR_STREAM_NOT_FOUND (-0x2dabac08) ///< Stream not found 61 | #define AVERROR_BUG (-0x5fb8aabe) ///< Bug detected, please report the issue 62 | #define AVERROR_UNKNOWN (-0x31b4b1ab) ///< Unknown error, typically from an external library 63 | #define AVERROR_EXPERIMENTAL (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it. 64 | 65 | /** 66 | * Put a description of the AVERROR code errnum in errbuf. 67 | * In case of failure the global variable errno is set to indicate the 68 | * error. Even in case of failure av_strerror() will print a generic 69 | * error message indicating the errnum provided to errbuf. 70 | * 71 | * @param errnum error code to describe 72 | * @param errbuf buffer to which description is written 73 | * @param errbuf_size the size in bytes of errbuf 74 | * @return 0 on success, a negative value if a description for errnum 75 | * cannot be found 76 | */ 77 | int av_strerror(int errnum, char *errbuf, size_t errbuf_size); 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | #endif /* AVUTIL_ERROR_H */ 84 | -------------------------------------------------------------------------------- /LibertyV/Rage/Audio/AWC/WAVFile.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.IO; 26 | using LibertyV.Utils; 27 | 28 | namespace LibertyV.Rage.Audio.AWC 29 | { 30 | static class WAVFile 31 | { 32 | public static void WAVFromPCM(Stream input, Stream output, short channels, int samplesPerSec, int bitsPerSample, int samples = 0, IProgressReport writingProgress = null) 33 | { 34 | short sample_size = (short)((bitsPerSample / 8) * channels); 35 | 36 | using (BinaryWriter writer = new BinaryWriter(new StreamKeeper(output))) 37 | { 38 | writer.Write(new char[] { 'R', 'I', 'F', 'F' }); 39 | writer.Write((int)0); // Skip size of wave file 40 | writer.Write(new char[] { 'W', 'A', 'V', 'E' }); 41 | writer.Write(new char[] { 'f', 'm', 't', ' ' }); 42 | writer.Write((int)16); // Size of header 43 | writer.Write((short)1); // Format tag - PCM 44 | writer.Write(channels); 45 | writer.Write(samplesPerSec); 46 | writer.Write((int)(sample_size * samplesPerSec)); // average bytes per sec 47 | writer.Write(sample_size); // full sample size.. 48 | writer.Write((short)bitsPerSample); 49 | writer.Write(new char[] { 'd', 'a', 't', 'a' }); 50 | writer.Write((int)0); // Skip size of data 51 | } 52 | if (samples != 0) 53 | { 54 | if (input.CopyToCount(output, samples * sample_size, writingProgress) != samples * sample_size) 55 | { 56 | // Check output size 57 | throw new Exception("Invalid WAV size"); 58 | } 59 | } 60 | else 61 | { 62 | // Write the pcm 63 | input.CopyTo(output); 64 | 65 | if (writingProgress != null) 66 | { 67 | writingProgress.SetProgress(writingProgress.GetFullValue()); 68 | } 69 | 70 | } 71 | output.Seek(4, SeekOrigin.Begin); 72 | // Write the size 73 | using (BinaryWriter writer = new BinaryWriter(new StreamKeeper(output))) 74 | { 75 | writer.Write((int)(output.Length - 8)); 76 | } 77 | output.Seek(40, SeekOrigin.Begin); 78 | // Write the size 79 | using (BinaryWriter writer = new BinaryWriter(new StreamKeeper(output))) 80 | { 81 | writer.Write((int)(output.Length - 44)); 82 | } 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/attributes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2006 Michael Niedermayer 3 | * 4 | * This file is part of Libav. 5 | * 6 | * Libav is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * Libav is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with Libav; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /** 22 | * @file 23 | * Macro definitions for various function/variable attributes 24 | */ 25 | 26 | #ifndef AVUTIL_ATTRIBUTES_H 27 | #define AVUTIL_ATTRIBUTES_H 28 | 29 | #ifdef __GNUC__ 30 | # define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y) 31 | #else 32 | # define AV_GCC_VERSION_AT_LEAST(x,y) 0 33 | #endif 34 | 35 | #if AV_GCC_VERSION_AT_LEAST(3,1) 36 | # define av_always_inline __attribute__((always_inline)) inline 37 | #elif defined(_MSC_VER) 38 | # define av_always_inline __forceinline 39 | #else 40 | # define av_always_inline inline 41 | #endif 42 | 43 | #if AV_GCC_VERSION_AT_LEAST(3,1) 44 | # define av_noinline __attribute__((noinline)) 45 | #elif defined(_MSC_VER) 46 | # define av_noinline __declspec(noinline) 47 | #else 48 | # define av_noinline 49 | #endif 50 | 51 | #if AV_GCC_VERSION_AT_LEAST(3,1) 52 | # define av_pure __attribute__((pure)) 53 | #else 54 | # define av_pure 55 | #endif 56 | 57 | #if AV_GCC_VERSION_AT_LEAST(2,6) 58 | # define av_const __attribute__((const)) 59 | #else 60 | # define av_const 61 | #endif 62 | 63 | #if AV_GCC_VERSION_AT_LEAST(4,3) 64 | # define av_cold __attribute__((cold)) 65 | #else 66 | # define av_cold 67 | #endif 68 | 69 | #if AV_GCC_VERSION_AT_LEAST(4,1) 70 | # define av_flatten __attribute__((flatten)) 71 | #else 72 | # define av_flatten 73 | #endif 74 | 75 | #if AV_GCC_VERSION_AT_LEAST(3,1) 76 | # define attribute_deprecated __attribute__((deprecated)) 77 | #elif defined(_MSC_VER) 78 | # define attribute_deprecated __declspec(deprecated) 79 | #else 80 | # define attribute_deprecated 81 | #endif 82 | 83 | #if defined(__GNUC__) 84 | # define av_unused __attribute__((unused)) 85 | #else 86 | # define av_unused 87 | #endif 88 | 89 | /** 90 | * Mark a variable as used and prevent the compiler from optimizing it 91 | * away. This is useful for variables accessed only from inline 92 | * assembler without the compiler being aware. 93 | */ 94 | #if AV_GCC_VERSION_AT_LEAST(3,1) 95 | # define av_used __attribute__((used)) 96 | #else 97 | # define av_used 98 | #endif 99 | 100 | #if AV_GCC_VERSION_AT_LEAST(3,3) 101 | # define av_alias __attribute__((may_alias)) 102 | #else 103 | # define av_alias 104 | #endif 105 | 106 | #if defined(__GNUC__) && !defined(__ICC) 107 | # define av_uninit(x) x=x 108 | #else 109 | # define av_uninit(x) x 110 | #endif 111 | 112 | #ifdef __GNUC__ 113 | # define av_builtin_constant_p __builtin_constant_p 114 | # define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos))) 115 | #else 116 | # define av_builtin_constant_p(x) 0 117 | # define av_printf_format(fmtpos, attrpos) 118 | #endif 119 | 120 | #if AV_GCC_VERSION_AT_LEAST(2,5) 121 | # define av_noreturn __attribute__((noreturn)) 122 | #else 123 | # define av_noreturn 124 | #endif 125 | 126 | #endif /* AVUTIL_ATTRIBUTES_H */ 127 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/mathematics.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2005 Michael Niedermayer 3 | * 4 | * This file is part of Libav. 5 | * 6 | * Libav is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * Libav is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with Libav; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef AVUTIL_MATHEMATICS_H 22 | #define AVUTIL_MATHEMATICS_H 23 | 24 | #include 25 | #include 26 | #include "attributes.h" 27 | #include "rational.h" 28 | #include "intfloat.h" 29 | 30 | #ifndef M_LOG2_10 31 | #define M_LOG2_10 3.32192809488736234787 /* log_2 10 */ 32 | #endif 33 | #ifndef M_PHI 34 | #define M_PHI 1.61803398874989484820 /* phi / golden ratio */ 35 | #endif 36 | #ifndef NAN 37 | #define NAN av_int2float(0x7fc00000) 38 | #endif 39 | #ifndef INFINITY 40 | #define INFINITY av_int2float(0x7f800000) 41 | #endif 42 | 43 | /** 44 | * @addtogroup lavu_math 45 | * @{ 46 | */ 47 | 48 | 49 | enum AVRounding { 50 | AV_ROUND_ZERO = 0, ///< Round toward zero. 51 | AV_ROUND_INF = 1, ///< Round away from zero. 52 | AV_ROUND_DOWN = 2, ///< Round toward -infinity. 53 | AV_ROUND_UP = 3, ///< Round toward +infinity. 54 | AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero. 55 | }; 56 | 57 | /** 58 | * Return the greatest common divisor of a and b. 59 | * If both a and b are 0 or either or both are <0 then behavior is 60 | * undefined. 61 | */ 62 | int64_t av_const av_gcd(int64_t a, int64_t b); 63 | 64 | /** 65 | * Rescale a 64-bit integer with rounding to nearest. 66 | * A simple a*b/c isn't possible as it can overflow. 67 | */ 68 | int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const; 69 | 70 | /** 71 | * Rescale a 64-bit integer with specified rounding. 72 | * A simple a*b/c isn't possible as it can overflow. 73 | */ 74 | int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const; 75 | 76 | /** 77 | * Rescale a 64-bit integer by 2 rational numbers. 78 | */ 79 | int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const; 80 | 81 | /** 82 | * Rescale a 64-bit integer by 2 rational numbers with specified rounding. 83 | */ 84 | int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, 85 | enum AVRounding) av_const; 86 | 87 | /** 88 | * Compare 2 timestamps each in its own timebases. 89 | * The result of the function is undefined if one of the timestamps 90 | * is outside the int64_t range when represented in the others timebase. 91 | * @return -1 if ts_a is before ts_b, 1 if ts_a is after ts_b or 0 if they represent the same position 92 | */ 93 | int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b); 94 | 95 | /** 96 | * Compare 2 integers modulo mod. 97 | * That is we compare integers a and b for which only the least 98 | * significant log2(mod) bits are known. 99 | * 100 | * @param mod must be a power of 2 101 | * @return a negative value if a is smaller than b 102 | * a positive value if a is greater than b 103 | * 0 if a equals b 104 | */ 105 | int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod); 106 | 107 | /** 108 | * @} 109 | */ 110 | 111 | #endif /* AVUTIL_MATHEMATICS_H */ 112 | -------------------------------------------------------------------------------- /LibertyV/Rage/Audio/AWC/Audio.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using System.IO; 26 | using LibertyV.Rage.Audio.Codecs.MP3; 27 | using LibertyV.Utils; 28 | using LibertyV.Rage.Audio.Codecs.XMA; 29 | 30 | namespace LibertyV.Rage.Audio.AWC 31 | { 32 | class Audio : IAudio 33 | { 34 | Stream Data; 35 | uint Samples; 36 | int SamplesPerSecond; 37 | 38 | public Audio(Stream data, uint samples, int samplesPerSecond) 39 | { 40 | this.Samples = samples; 41 | this.SamplesPerSecond = samplesPerSecond; 42 | this.Data = data; 43 | } 44 | 45 | public Audio(Stream data, Structs.FormatChunk chunkInfo) 46 | { 47 | this.Samples = chunkInfo.Samples; 48 | this.SamplesPerSecond = chunkInfo.SamplesPerSecond; 49 | this.Data = data; 50 | } 51 | 52 | public int GetBits() 53 | { 54 | return GlobalOptions.AudioBits; 55 | } 56 | 57 | public uint GetSamplesCount() 58 | { 59 | return Samples; 60 | } 61 | 62 | public int GetSamplesPerSecond() 63 | { 64 | return SamplesPerSecond; 65 | } 66 | 67 | public int GetChannels() 68 | { 69 | return 1; 70 | } 71 | 72 | public int GetSize() 73 | { 74 | return (int)((this.GetBits() / 8) * this.GetChannels() * this.GetSamplesCount()); 75 | } 76 | 77 | public Stream GetPCMStream() 78 | { 79 | if (GlobalOptions.Platform == Platform.PlatformType.PLAYSTATION3) 80 | { 81 | // The playstation3 use mp3 encode 82 | // The partial stream is because we want that each reader will have its own seeker 83 | return new MP3DecoderStream(new PartialStream(this.Data, 0, this.Data.Length)); 84 | } 85 | else if (GlobalOptions.Platform == Platform.PlatformType.XBOX360) 86 | { 87 | return new XMA2DecoderStream(new PartialStream(this.Data, 0, this.Data.Length)); 88 | } 89 | return null; 90 | } 91 | 92 | public static Stream GetCodecStream(Stream input) 93 | { 94 | if (GlobalOptions.Platform == Platform.PlatformType.PLAYSTATION3) 95 | { 96 | // The playstation3 use mp3 encode 97 | // The partial stream is because we want that each reader will have its own seeker 98 | return new MP3DecoderStream(input); 99 | } 100 | else if (GlobalOptions.Platform == Platform.PlatformType.XBOX360) 101 | { 102 | return new XMA2DecoderStream(input); 103 | } 104 | return null; 105 | } 106 | 107 | public void Dispose() 108 | { 109 | Data.Dispose(); 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /libav_wrapper/include/libavcodec/vda.h: -------------------------------------------------------------------------------- 1 | /* 2 | * VDA HW acceleration 3 | * 4 | * copyright (c) 2011 Sebastien Zwickert 5 | * 6 | * This file is part of Libav. 7 | * 8 | * Libav is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * Libav is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with Libav; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #ifndef AVCODEC_VDA_H 24 | #define AVCODEC_VDA_H 25 | 26 | /** 27 | * @file 28 | * @ingroup lavc_codec_hwaccel_vda 29 | * Public libavcodec VDA header. 30 | */ 31 | 32 | #include "libavcodec/version.h" 33 | 34 | #include 35 | 36 | // emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes 37 | // http://openradar.appspot.com/8026390 38 | #undef __GNUC_STDC_INLINE__ 39 | 40 | #define Picture QuickdrawPicture 41 | #include 42 | #undef Picture 43 | 44 | /** 45 | * @defgroup lavc_codec_hwaccel_vda VDA 46 | * @ingroup lavc_codec_hwaccel 47 | * 48 | * @{ 49 | */ 50 | 51 | /** 52 | * This structure is used to provide the necessary configurations and data 53 | * to the VDA Libav HWAccel implementation. 54 | * 55 | * The application must make it available as AVCodecContext.hwaccel_context. 56 | */ 57 | struct vda_context { 58 | /** 59 | * VDA decoder object. 60 | * 61 | * - encoding: unused 62 | * - decoding: Set/Unset by libavcodec. 63 | */ 64 | VDADecoder decoder; 65 | 66 | /** 67 | * The Core Video pixel buffer that contains the current image data. 68 | * 69 | * encoding: unused 70 | * decoding: Set by libavcodec. Unset by user. 71 | */ 72 | CVPixelBufferRef cv_buffer; 73 | 74 | /** 75 | * Use the hardware decoder in synchronous mode. 76 | * 77 | * encoding: unused 78 | * decoding: Set by user. 79 | */ 80 | int use_sync_decoding; 81 | 82 | /** 83 | * The frame width. 84 | * 85 | * - encoding: unused 86 | * - decoding: Set/Unset by user. 87 | */ 88 | int width; 89 | 90 | /** 91 | * The frame height. 92 | * 93 | * - encoding: unused 94 | * - decoding: Set/Unset by user. 95 | */ 96 | int height; 97 | 98 | /** 99 | * The frame format. 100 | * 101 | * - encoding: unused 102 | * - decoding: Set/Unset by user. 103 | */ 104 | int format; 105 | 106 | /** 107 | * The pixel format for output image buffers. 108 | * 109 | * - encoding: unused 110 | * - decoding: Set/Unset by user. 111 | */ 112 | OSType cv_pix_fmt_type; 113 | 114 | /** 115 | * The current bitstream buffer. 116 | */ 117 | uint8_t *priv_bitstream; 118 | 119 | /** 120 | * The current size of the bitstream. 121 | */ 122 | int priv_bitstream_size; 123 | 124 | /** 125 | * The reference size used for fast reallocation. 126 | */ 127 | int priv_allocated_size; 128 | }; 129 | 130 | /** Create the video decoder. */ 131 | int ff_vda_create_decoder(struct vda_context *vda_ctx, 132 | uint8_t *extradata, 133 | int extradata_size); 134 | 135 | /** Destroy the video decoder. */ 136 | int ff_vda_destroy_decoder(struct vda_context *vda_ctx); 137 | 138 | /** 139 | * @} 140 | */ 141 | 142 | #endif /* AVCODEC_VDA_H */ 143 | -------------------------------------------------------------------------------- /LibertyV/Utils/Range.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | 26 | namespace LibertyV.Utils 27 | { 28 | class ItemsRange 29 | { 30 | public long Position; 31 | public long Size; 32 | public List Objects; 33 | 34 | public ItemsRange(long position, long size) 35 | { 36 | this.Position = position; 37 | this.Size = size; 38 | this.Objects = new List(); 39 | } 40 | 41 | public ItemsRange(long position, long size, T obj) 42 | : this(position, size) 43 | { 44 | this.Objects.Add(obj); 45 | } 46 | 47 | public ItemsRange(long position, long size, List objs) 48 | { 49 | this.Position = position; 50 | this.Size = size; 51 | this.Objects = objs; 52 | } 53 | } 54 | class Range 55 | { 56 | 57 | // Key - position 58 | // Tuple int - size 59 | // Tuple T - object 60 | private SortedList> RangesList = new SortedList>(); 61 | private long Size; 62 | 63 | public Range(long size = Int64.MaxValue) 64 | { 65 | if (size < 0) { 66 | throw new Exception("Invalid size"); 67 | } 68 | this.Size = size; 69 | } 70 | 71 | public bool AddItem(long position, long size, T obj, bool addIfExists = true) 72 | { 73 | if (position < 0 || position > this.Size || size < 0 || position + size > this.Size) 74 | { 75 | // Invalid arguments... 76 | return false; 77 | } 78 | int newPos = RangesList.Keys.ToList().BinarySearch(position); 79 | if (newPos >= 0) 80 | { 81 | if (size == 0) 82 | { 83 | // Hmmm, my container can't really handle empty sizes, so I won't add it 84 | return true; 85 | } 86 | // Item existing, check if it has the same info 87 | if (addIfExists && RangesList[position].Size == size) 88 | { 89 | RangesList[position].Objects.Add(obj); 90 | return true; 91 | } 92 | return false; 93 | } 94 | newPos = ~newPos; 95 | long lastEnd = 0; 96 | if (newPos > 0) 97 | { 98 | var elem = RangesList.ElementAt(newPos - 1); 99 | lastEnd = elem.Key + elem.Value.Size; 100 | } 101 | if (position < lastEnd) 102 | { 103 | return false; 104 | } 105 | if (size == 0) 106 | { 107 | // Hmmm, my container can't really handle empty sizes, so I won't add it 108 | return true; 109 | } 110 | RangesList[position] = new ItemsRange(position, size, obj); 111 | return true; 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /LibertyV/Operations/AWCOperations.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using LibertyV.Rage.RPF.V7.Entries; 26 | using LibertyV.Rage.Audio.AWC; 27 | using System.IO; 28 | using LibertyV.Utils; 29 | using System.Windows.Forms; 30 | 31 | namespace LibertyV.Operations 32 | { 33 | static class AWCOperations 34 | { 35 | public static bool IsAWC(FileEntry entry) 36 | { 37 | return entry.GetExtension() == ".awc"; 38 | } 39 | 40 | public static bool IsAWCs(List entries) 41 | { 42 | return !entries.Any(entry => entry.GetExtension() != ".awc"); 43 | } 44 | 45 | public static void ExportAWC(FileEntry entry) 46 | { 47 | string selectedFolder = GUI.FolderSelection(); 48 | if (selectedFolder != null) 49 | { 50 | try 51 | { 52 | using (AWCFile awc = new AWCFile(entry.Data.GetStream())) 53 | { 54 | ProgressWindow progress = new ProgressWindow("Exporting", report => awc.ExportWav(Path.Combine(selectedFolder, entry.Name), report), true); 55 | progress.Run(); 56 | } 57 | } 58 | catch (OperationCanceledException) 59 | { 60 | MessageBox.Show("Operation canceled."); 61 | } 62 | catch (Exception) 63 | { 64 | MessageBox.Show("Failed to open AWC, please report to the developer"); 65 | } 66 | } 67 | } 68 | 69 | public static void ExportAWCs(List entries) 70 | { 71 | string selectedFolder = GUI.FolderSelection(); 72 | if (selectedFolder != null) 73 | { 74 | ProgressWindow progress = new ProgressWindow("Exporting", report => 75 | { 76 | int passed = 0; 77 | // Set the progress by the size of the file 78 | report = new SubProgressReport(report, entries.Sum(entry => entry.Data.GetSize())); 79 | foreach (FileEntry entry in entries) 80 | { 81 | using (AWCFile awc = new AWCFile(entry.Data.GetStream())) 82 | { 83 | awc.ExportWav(Path.Combine(selectedFolder, entry.Name), new SubProgressReport(report, passed, entry.Data.GetSize())); 84 | passed += entry.Data.GetSize(); 85 | } 86 | } 87 | }, true); 88 | try 89 | { 90 | progress.Run(); 91 | } 92 | catch (OperationCanceledException) 93 | { 94 | MessageBox.Show("Operation canceled."); 95 | } 96 | catch (Exception) 97 | { 98 | MessageBox.Show("Failed to open AWC, please report to the developer"); 99 | } 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /LibertyV/Operations/RegularFileProperties.Designer.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | namespace LibertyV.Operations 22 | { 23 | partial class RegularFileProperties 24 | { 25 | /// 26 | /// Required designer variable. 27 | /// 28 | private System.ComponentModel.IContainer components = null; 29 | 30 | /// 31 | /// Clean up any resources being used. 32 | /// 33 | /// true if managed resources should be disposed; otherwise, false. 34 | protected override void Dispose(bool disposing) 35 | { 36 | if (disposing && (components != null)) 37 | { 38 | components.Dispose(); 39 | } 40 | base.Dispose(disposing); 41 | } 42 | 43 | #region Windows Form Designer generated code 44 | 45 | /// 46 | /// Required method for Designer support - do not modify 47 | /// the contents of this method with the code editor. 48 | /// 49 | private void InitializeComponent() 50 | { 51 | this.isCompressedCheckBox = new System.Windows.Forms.CheckBox(); 52 | this.button1 = new System.Windows.Forms.Button(); 53 | this.SuspendLayout(); 54 | // 55 | // isCompressedCheckBox 56 | // 57 | this.isCompressedCheckBox.AutoSize = true; 58 | this.isCompressedCheckBox.Location = new System.Drawing.Point(12, 12); 59 | this.isCompressedCheckBox.Name = "isCompressedCheckBox"; 60 | this.isCompressedCheckBox.Size = new System.Drawing.Size(84, 17); 61 | this.isCompressedCheckBox.TabIndex = 0; 62 | this.isCompressedCheckBox.Text = "Compressed"; 63 | this.isCompressedCheckBox.UseVisualStyleBackColor = true; 64 | // 65 | // button1 66 | // 67 | this.button1.Location = new System.Drawing.Point(77, 103); 68 | this.button1.Name = "button1"; 69 | this.button1.Size = new System.Drawing.Size(75, 23); 70 | this.button1.TabIndex = 1; 71 | this.button1.Text = "Close"; 72 | this.button1.UseVisualStyleBackColor = true; 73 | this.button1.Click += new System.EventHandler(this.button1_Click); 74 | // 75 | // RegularFileProperties 76 | // 77 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 78 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 79 | this.ClientSize = new System.Drawing.Size(224, 138); 80 | this.ControlBox = false; 81 | this.Controls.Add(this.button1); 82 | this.Controls.Add(this.isCompressedCheckBox); 83 | this.Name = "RegularFileProperties"; 84 | this.ShowIcon = false; 85 | this.ShowInTaskbar = false; 86 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 87 | this.Text = "Properties"; 88 | this.ResumeLayout(false); 89 | this.PerformLayout(); 90 | 91 | } 92 | 93 | #endregion 94 | 95 | private System.Windows.Forms.CheckBox isCompressedCheckBox; 96 | private System.Windows.Forms.Button button1; 97 | } 98 | } -------------------------------------------------------------------------------- /LibertyV/Operations/Export.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Text; 25 | using LibertyV.Rage.RPF.V7.Entries; 26 | using LibertyV.Utils; 27 | using System.Windows.Forms; 28 | 29 | namespace LibertyV.Operations 30 | { 31 | static class Export 32 | { 33 | 34 | public static void ExportFile(FileEntry entry) 35 | { 36 | string selectedFilename; 37 | // Open a folder selection instead of file selection only if there is need to. 38 | if (entry is ResourceEntry && Properties.Settings.Default.ExportResourcesChoice == Settings.ExportResourcesChoice.SYSGFX && ((ResourceEntry)entry).GraphicSize > 0) 39 | { 40 | selectedFilename = GUI.FolderSelection(); 41 | } 42 | else 43 | { 44 | selectedFilename = GUI.FileSaveSelection(entry.Name); 45 | } 46 | if (selectedFilename != null) 47 | { 48 | ProgressWindow progress = new ProgressWindow("Exporting", report => entry.Export(selectedFilename, report), true); 49 | try 50 | { 51 | progress.Run(); 52 | } 53 | catch (OperationCanceledException) 54 | { 55 | MessageBox.Show("Operation canceled."); 56 | } 57 | catch (Exception) 58 | { 59 | MessageBox.Show("Operation canceled."); 60 | } 61 | } 62 | } 63 | 64 | public static void ExportFiles(ICollection entries) 65 | { 66 | string selectedFolder = GUI.FolderSelection(); 67 | if (selectedFolder != null) 68 | { 69 | ProgressWindow progress = new ProgressWindow("Exporting", report => 70 | { 71 | int passed = 0; 72 | report = new SubProgressReport(report, entries.Sum(entry => entry.Data.GetSize())); 73 | foreach (FileEntry entry in entries) 74 | { 75 | entry.Export(selectedFolder, new SubProgressReport(report, passed, entry.Data.GetSize())); 76 | passed += entry.Data.GetSize(); 77 | } 78 | }, true); 79 | try 80 | { 81 | progress.Run(); 82 | } 83 | catch (OperationCanceledException) 84 | { 85 | MessageBox.Show("Operation canceled."); 86 | } 87 | } 88 | } 89 | 90 | public static void ExportFolder(DirectoryEntry entry) 91 | { 92 | string selectedFolder = GUI.FolderSelection(); 93 | if (selectedFolder != null) 94 | { 95 | ProgressWindow progress = new ProgressWindow("Exporting", report => entry.Export(selectedFolder, report), true); 96 | try 97 | { 98 | progress.Run(); 99 | } 100 | catch (OperationCanceledException) 101 | { 102 | MessageBox.Show("Operation canceled."); 103 | } 104 | } 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /lzx/lzx.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | {B97A470C-E6E6-4D61-AA00-60643A70E8CF} 21 | Win32Proj 22 | lzx 23 | 24 | 25 | 26 | DynamicLibrary 27 | true 28 | Unicode 29 | 30 | 31 | DynamicLibrary 32 | false 33 | true 34 | Unicode 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | true 48 | $(SolutionDir)bin\$(Configuration)\ 49 | 50 | 51 | false 52 | $(SolutionDir)bin\$(Configuration)\ 53 | 54 | 55 | 56 | 57 | 58 | Level3 59 | Disabled 60 | WIN32;_DEBUG;_WINDOWS;_USRDLL;LZX_EXPORTS;%(PreprocessorDefinitions) 61 | 62 | 63 | Windows 64 | true 65 | 66 | 67 | 68 | 69 | Level3 70 | 71 | 72 | MaxSpeed 73 | true 74 | true 75 | WIN32;NDEBUG;_WINDOWS;_USRDLL;LZX_EXPORTS;%(PreprocessorDefinitions) 76 | 77 | 78 | Windows 79 | true 80 | true 81 | true 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /LibertyV/Operations/ResourceProperties.Designer.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | namespace LibertyV.Operations 22 | { 23 | partial class ResourceProperties 24 | { 25 | /// 26 | /// Required designer variable. 27 | /// 28 | private System.ComponentModel.IContainer components = null; 29 | 30 | /// 31 | /// Clean up any resources being used. 32 | /// 33 | /// true if managed resources should be disposed; otherwise, false. 34 | protected override void Dispose(bool disposing) 35 | { 36 | if (disposing && (components != null)) 37 | { 38 | components.Dispose(); 39 | } 40 | base.Dispose(disposing); 41 | } 42 | 43 | #region Windows Form Designer generated code 44 | 45 | /// 46 | /// Required method for Designer support - do not modify 47 | /// the contents of this method with the code editor. 48 | /// 49 | private void InitializeComponent() 50 | { 51 | this.button1 = new System.Windows.Forms.Button(); 52 | this.label1 = new System.Windows.Forms.Label(); 53 | this.typeTextBox = new System.Windows.Forms.TextBox(); 54 | this.SuspendLayout(); 55 | // 56 | // button1 57 | // 58 | this.button1.Location = new System.Drawing.Point(77, 103); 59 | this.button1.Name = "button1"; 60 | this.button1.Size = new System.Drawing.Size(75, 23); 61 | this.button1.TabIndex = 1; 62 | this.button1.Text = "Close"; 63 | this.button1.UseVisualStyleBackColor = true; 64 | this.button1.Click += new System.EventHandler(this.button1_Click); 65 | // 66 | // label1 67 | // 68 | this.label1.AutoSize = true; 69 | this.label1.Location = new System.Drawing.Point(12, 15); 70 | this.label1.Name = "label1"; 71 | this.label1.Size = new System.Drawing.Size(34, 13); 72 | this.label1.TabIndex = 3; 73 | this.label1.Text = "Type:"; 74 | // 75 | // typeTextBox 76 | // 77 | this.typeTextBox.Location = new System.Drawing.Point(53, 13); 78 | this.typeTextBox.Name = "typeTextBox"; 79 | this.typeTextBox.Size = new System.Drawing.Size(47, 20); 80 | this.typeTextBox.TabIndex = 4; 81 | // 82 | // ResourceProperties 83 | // 84 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 85 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 86 | this.ClientSize = new System.Drawing.Size(224, 138); 87 | this.ControlBox = false; 88 | this.Controls.Add(this.typeTextBox); 89 | this.Controls.Add(this.label1); 90 | this.Controls.Add(this.button1); 91 | this.Name = "ResourceProperties"; 92 | this.ShowIcon = false; 93 | this.ShowInTaskbar = false; 94 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 95 | this.Text = "Properties"; 96 | this.ResumeLayout(false); 97 | this.PerformLayout(); 98 | 99 | } 100 | 101 | #endregion 102 | 103 | private System.Windows.Forms.Button button1; 104 | private System.Windows.Forms.Label label1; 105 | private System.Windows.Forms.TextBox typeTextBox; 106 | } 107 | } -------------------------------------------------------------------------------- /libav_wrapper/include/libavutil/rational.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rational numbers 3 | * Copyright (c) 2003 Michael Niedermayer 4 | * 5 | * This file is part of Libav. 6 | * 7 | * Libav is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or (at your option) any later version. 11 | * 12 | * Libav is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with Libav; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | /** 23 | * @file 24 | * rational numbers 25 | * @author Michael Niedermayer 26 | */ 27 | 28 | #ifndef AVUTIL_RATIONAL_H 29 | #define AVUTIL_RATIONAL_H 30 | 31 | #include 32 | #include 33 | #include "attributes.h" 34 | 35 | /** 36 | * @addtogroup lavu_math 37 | * @{ 38 | */ 39 | 40 | /** 41 | * rational number numerator/denominator 42 | */ 43 | typedef struct AVRational{ 44 | int num; ///< numerator 45 | int den; ///< denominator 46 | } AVRational; 47 | 48 | /** 49 | * Compare two rationals. 50 | * @param a first rational 51 | * @param b second rational 52 | * @return 0 if a==b, 1 if a>b, -1 if a>63)|1; 59 | else if(b.den && a.den) return 0; 60 | else if(a.num && b.num) return (a.num>>31) - (b.num>>31); 61 | else return INT_MIN; 62 | } 63 | 64 | /** 65 | * Convert rational to double. 66 | * @param a rational to convert 67 | * @return (double) a 68 | */ 69 | static inline double av_q2d(AVRational a){ 70 | return a.num / (double) a.den; 71 | } 72 | 73 | /** 74 | * Reduce a fraction. 75 | * This is useful for framerate calculations. 76 | * @param dst_num destination numerator 77 | * @param dst_den destination denominator 78 | * @param num source numerator 79 | * @param den source denominator 80 | * @param max the maximum allowed for dst_num & dst_den 81 | * @return 1 if exact, 0 otherwise 82 | */ 83 | int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max); 84 | 85 | /** 86 | * Multiply two rationals. 87 | * @param b first rational 88 | * @param c second rational 89 | * @return b*c 90 | */ 91 | AVRational av_mul_q(AVRational b, AVRational c) av_const; 92 | 93 | /** 94 | * Divide one rational by another. 95 | * @param b first rational 96 | * @param c second rational 97 | * @return b/c 98 | */ 99 | AVRational av_div_q(AVRational b, AVRational c) av_const; 100 | 101 | /** 102 | * Add two rationals. 103 | * @param b first rational 104 | * @param c second rational 105 | * @return b+c 106 | */ 107 | AVRational av_add_q(AVRational b, AVRational c) av_const; 108 | 109 | /** 110 | * Subtract one rational from another. 111 | * @param b first rational 112 | * @param c second rational 113 | * @return b-c 114 | */ 115 | AVRational av_sub_q(AVRational b, AVRational c) av_const; 116 | 117 | /** 118 | * Invert a rational. 119 | * @param q value 120 | * @return 1 / q 121 | */ 122 | static av_always_inline AVRational av_inv_q(AVRational q) 123 | { 124 | AVRational r = { q.den, q.num }; 125 | return r; 126 | } 127 | 128 | /** 129 | * Convert a double precision floating point number to a rational. 130 | * inf is expressed as {1,0} or {-1,0} depending on the sign. 131 | * 132 | * @param d double to convert 133 | * @param max the maximum allowed numerator and denominator 134 | * @return (AVRational) d 135 | */ 136 | AVRational av_d2q(double d, int max) av_const; 137 | 138 | /** 139 | * @return 1 if q1 is nearer to q than q2, -1 if q2 is nearer 140 | * than q1, 0 if they have the same distance. 141 | */ 142 | int av_nearer_q(AVRational q, AVRational q1, AVRational q2); 143 | 144 | /** 145 | * Find the nearest value in q_list to q. 146 | * @param q_list an array of rationals terminated by {0, 0} 147 | * @return the index of the nearest value found in the array 148 | */ 149 | int av_find_nearest_q_idx(AVRational q, const AVRational* q_list); 150 | 151 | /** 152 | * @} 153 | */ 154 | 155 | #endif /* AVUTIL_RATIONAL_H */ 156 | -------------------------------------------------------------------------------- /LibertyV/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | LibertyV - Viewer/Editor for RAGE Package File version 7 4 | Copyright (C) 2013 koolk 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | 19 | */ 20 | 21 | //------------------------------------------------------------------------------ 22 | // 23 | // This code was generated by a tool. 24 | // Runtime Version:4.0.30319.1008 25 | // 26 | // Changes to this file may cause incorrect behavior and will be lost if 27 | // the code is regenerated. 28 | // 29 | //------------------------------------------------------------------------------ 30 | 31 | namespace LibertyV.Properties { 32 | 33 | 34 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 35 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 36 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 37 | 38 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 39 | 40 | public static Settings Default { 41 | get { 42 | return defaultInstance; 43 | } 44 | } 45 | 46 | [global::System.Configuration.UserScopedSettingAttribute()] 47 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 48 | [global::System.Configuration.DefaultSettingValueAttribute("0")] 49 | public global::LibertyV.Settings.ExportResourcesChoice ExportResourcesChoice { 50 | get { 51 | return ((global::LibertyV.Settings.ExportResourcesChoice)(this["ExportResourcesChoice"])); 52 | } 53 | set { 54 | this["ExportResourcesChoice"] = value; 55 | } 56 | } 57 | 58 | [global::System.Configuration.UserScopedSettingAttribute()] 59 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 60 | [global::System.Configuration.DefaultSettingValueAttribute("key_xbox360.dat")] 61 | public string Xbox360KeyFile { 62 | get { 63 | return ((string)(this["Xbox360KeyFile"])); 64 | } 65 | set { 66 | this["Xbox360KeyFile"] = value; 67 | } 68 | } 69 | 70 | [global::System.Configuration.UserScopedSettingAttribute()] 71 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 72 | [global::System.Configuration.DefaultSettingValueAttribute("key_ps3.dat")] 73 | public string PS3KeyFile { 74 | get { 75 | return ((string)(this["PS3KeyFile"])); 76 | } 77 | set { 78 | this["PS3KeyFile"] = value; 79 | } 80 | } 81 | 82 | [global::System.Configuration.UserScopedSettingAttribute()] 83 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 84 | [global::System.Configuration.DefaultSettingValueAttribute("False")] 85 | public bool Xbox360KeyFileEnabled { 86 | get { 87 | return ((bool)(this["Xbox360KeyFileEnabled"])); 88 | } 89 | set { 90 | this["Xbox360KeyFileEnabled"] = value; 91 | } 92 | } 93 | 94 | [global::System.Configuration.UserScopedSettingAttribute()] 95 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 96 | [global::System.Configuration.DefaultSettingValueAttribute("False")] 97 | public bool PS3KeyFileEnabled { 98 | get { 99 | return ((bool)(this["PS3KeyFileEnabled"])); 100 | } 101 | set { 102 | this["PS3KeyFileEnabled"] = value; 103 | } 104 | } 105 | } 106 | } 107 | --------------------------------------------------------------------------------