mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 03:25:14 -04:00
fix crashing on invalid .zip files
This commit is contained in:
parent
7ca1e00fcd
commit
43b8a419cd
@ -57,7 +57,7 @@ namespace ClassicalSharp.Textures {
|
||||
if (useLavaAnim) {
|
||||
int size = Math.Min(Atlas2D.TileSize, 64);
|
||||
DrawAnimation(null, 30, size);
|
||||
}
|
||||
}
|
||||
if (useWaterAnim) {
|
||||
int size = Math.Min(Atlas2D.TileSize, 64);
|
||||
DrawAnimation(null, 14, size);
|
||||
|
@ -33,8 +33,9 @@ namespace ClassicalSharp.Textures {
|
||||
uint sig = 0;
|
||||
|
||||
// At -22 for nearly all zips, but try a bit further back in case of comment
|
||||
for (int i = -22; i >= -256; i--) {
|
||||
reader.BaseStream.Seek(i, SeekOrigin.End);
|
||||
int len = Math.Min(257, (int)stream.Length);
|
||||
for (int i = 22; i < len; i++) {
|
||||
stream.Seek(-i, SeekOrigin.End);
|
||||
sig = reader.ReadUInt32();
|
||||
if (sig == 0x06054b50) break;
|
||||
}
|
||||
|
@ -583,14 +583,6 @@ namespace OpenTK.Platform.Windows {
|
||||
APPS = 0x5D,
|
||||
SLEEP = 0x5F,
|
||||
NUMPAD0 = 0x60,
|
||||
NUMPAD1 = 0x61,
|
||||
NUMPAD2 = 0x62,
|
||||
NUMPAD3 = 0x63,
|
||||
NUMPAD4 = 0x64,
|
||||
NUMPAD5 = 0x65,
|
||||
NUMPAD6 = 0x66,
|
||||
NUMPAD7 = 0x67,
|
||||
NUMPAD8 = 0x68,
|
||||
NUMPAD9 = 0x69,
|
||||
MULTIPLY = 0x6A,
|
||||
ADD = 0x6B,
|
||||
|
@ -1,233 +1,225 @@
|
||||
#region --- License ---
|
||||
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
|
||||
* Contributions from Erik Ylvisaker
|
||||
* See license.txt for license info
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#pragma warning disable 3019 // CLS-compliance checking
|
||||
#pragma warning disable 0649 // struct members not explicitly initialized
|
||||
#pragma warning disable 0169 // field / method is never used.
|
||||
#pragma warning disable 0414 // field assigned but never used.
|
||||
|
||||
namespace OpenTK.Platform.X11 {
|
||||
|
||||
using Window = System.IntPtr;
|
||||
using VisualID = System.IntPtr;
|
||||
using Display = System.IntPtr;
|
||||
using Bool = System.Boolean;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct XVisualInfo {
|
||||
public IntPtr Visual;
|
||||
public VisualID VisualID;
|
||||
public int Screen;
|
||||
public int Depth;
|
||||
public XVisualClass Class;
|
||||
public long RedMask;
|
||||
public long GreenMask;
|
||||
public long blueMask;
|
||||
public int ColormapSize;
|
||||
public int BitsPerRgb;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct XRRScreenSize {
|
||||
internal int Width, Height;
|
||||
internal int MWidth, MHeight;
|
||||
}
|
||||
|
||||
internal enum ErrorCodes : int {
|
||||
Success = 0,
|
||||
BadRequest = 1,
|
||||
BadValue = 2,
|
||||
BadWindow = 3,
|
||||
BadPixmap = 4,
|
||||
BadAtom = 5,
|
||||
BadCursor = 6,
|
||||
BadFont = 7,
|
||||
BadMatch = 8,
|
||||
BadDrawable = 9,
|
||||
BadAccess = 10,
|
||||
BadAlloc = 11,
|
||||
BadColor = 12,
|
||||
BadGC = 13,
|
||||
BadIDChoice = 14,
|
||||
BadName = 15,
|
||||
BadLength = 16,
|
||||
BadImplementation = 17,
|
||||
}
|
||||
|
||||
/// <summary> Defines LATIN-1 and miscellaneous keys. </summary>
|
||||
internal enum XKey {
|
||||
/* TTY function keys, cleverly chosen to map to ASCII, for convenience of
|
||||
* programming, but could have been arbitrary (at the cost of lookup
|
||||
* tables in client code). */
|
||||
|
||||
BackSpace = 0xff08, /* Back space, back char */
|
||||
Tab = 0xff09,
|
||||
Linefeed = 0xff0a, /* Linefeed, LF */
|
||||
Clear = 0xff0b,
|
||||
Return = 0xff0d, /* Return, enter */
|
||||
Pause = 0xff13, /* Pause, hold */
|
||||
Scroll_Lock = 0xff14,
|
||||
Sys_Req = 0xff15,
|
||||
Escape = 0xff1b,
|
||||
Delete = 0xffff, /* Delete, rubout */
|
||||
|
||||
/* Cursor control & motion */
|
||||
Home = 0xff50,
|
||||
Left = 0xff51, /* Move left, left arrow */
|
||||
Up = 0xff52, /* Move up, up arrow */
|
||||
Right = 0xff53, /* Move right, right arrow */
|
||||
Down = 0xff54, /* Move down, down arrow */
|
||||
Page_Up = 0xff55,
|
||||
Page_Down = 0xff56,
|
||||
End = 0xff57, /* EOL */
|
||||
|
||||
/* Misc functions */
|
||||
Print = 0xff61,
|
||||
Insert = 0xff63, /* Insert, insert here */
|
||||
Menu = 0xff67,
|
||||
Break = 0xff6b,
|
||||
Num_Lock = 0xff7f,
|
||||
|
||||
/* Keypad functions, keypad numbers cleverly chosen to map to ASCII */
|
||||
KP_Space = 0xff80, /* Space */
|
||||
KP_Tab = 0xff89,
|
||||
KP_Enter = 0xff8d, /* Enter */
|
||||
KP_F1 = 0xff91, /* PF1, KP_A, ... */
|
||||
KP_F2 = 0xff92,
|
||||
KP_F3 = 0xff93,
|
||||
KP_F4 = 0xff94,
|
||||
KP_Home = 0xff95,
|
||||
KP_Left = 0xff96,
|
||||
KP_Up = 0xff97,
|
||||
KP_Right = 0xff98,
|
||||
KP_Down = 0xff99,
|
||||
KP_Prior = 0xff9a,
|
||||
KP_Page_Up = 0xff9a,
|
||||
KP_Next = 0xff9b,
|
||||
KP_Page_Down = 0xff9b,
|
||||
KP_End = 0xff9c,
|
||||
KP_Begin = 0xff9d,
|
||||
KP_Insert = 0xff9e,
|
||||
KP_Delete = 0xff9f,
|
||||
KP_Equal = 0xffbd, /* Equals */
|
||||
KP_Multiply = 0xffaa,
|
||||
KP_Add = 0xffab,
|
||||
KP_Separator = 0xffac, /* Separator, often comma */
|
||||
KP_Subtract = 0xffad,
|
||||
KP_Decimal = 0xffae,
|
||||
KP_Divide = 0xffaf,
|
||||
|
||||
KP_0 = 0xffb0,
|
||||
KP_1 = 0xffb1,
|
||||
KP_2 = 0xffb2,
|
||||
KP_3 = 0xffb3,
|
||||
KP_4 = 0xffb4,
|
||||
KP_5 = 0xffb5,
|
||||
KP_6 = 0xffb6,
|
||||
KP_7 = 0xffb7,
|
||||
KP_8 = 0xffb8,
|
||||
KP_9 = 0xffb9,
|
||||
|
||||
/*
|
||||
* Auxiliary functions; note the duplicate definitions for left and right
|
||||
* function keys; Sun keyboards and a few other manufacturers have such
|
||||
* function key groups on the left and/or right sides of the keyboard.
|
||||
* We've not found a keyboard with more than 35 function keys total.
|
||||
*/
|
||||
F1 = 0xffbe,
|
||||
F35 = 0xffe0,
|
||||
|
||||
/* Modifiers */
|
||||
|
||||
Shift_L = 0xffe1, /* Left shift */
|
||||
Shift_R = 0xffe2, /* Right shift */
|
||||
Control_L = 0xffe3, /* Left control */
|
||||
Control_R = 0xffe4, /* Right control */
|
||||
Caps_Lock = 0xffe5, /* Caps lock */
|
||||
Shift_Lock = 0xffe6, /* Shift lock */
|
||||
|
||||
Meta_L = 0xffe7, /* Left meta */
|
||||
Meta_R = 0xffe8, /* Right meta */
|
||||
Alt_L = 0xffe9, /* Left alt */
|
||||
Alt_R = 0xffea, /* Right alt */
|
||||
Super_L = 0xffeb, /* Left super */
|
||||
Super_R = 0xffec, /* Right super */
|
||||
|
||||
/*
|
||||
* Latin 1
|
||||
* (ISO/IEC 8859-1 = Unicode U+0020..U+00FF)
|
||||
* Byte 3 = 0
|
||||
*/
|
||||
|
||||
space = 0x0020, /* U+0020 SPACE */
|
||||
exclam = 0x0021, /* U+0021 EXCLAMATION MARK */
|
||||
quotedbl = 0x0022, /* U+0022 QUOTATION MARK */
|
||||
numbersign = 0x0023, /* U+0023 NUMBER SIGN */
|
||||
dollar = 0x0024, /* U+0024 DOLLAR SIGN */
|
||||
percent = 0x0025, /* U+0025 PERCENT SIGN */
|
||||
ampersand = 0x0026, /* U+0026 AMPERSAND */
|
||||
apostrophe = 0x0027, /* U+0027 APOSTROPHE */
|
||||
quoteright = 0x0027, /* deprecated */
|
||||
parenleft = 0x0028, /* U+0028 LEFT PARENTHESIS */
|
||||
parenright = 0x0029, /* U+0029 RIGHT PARENTHESIS */
|
||||
asterisk = 0x002a, /* U+002A ASTERISK */
|
||||
plus = 0x002b, /* U+002B PLUS SIGN */
|
||||
comma = 0x002c, /* U+002C COMMA */
|
||||
minus = 0x002d, /* U+002D HYPHEN-MINUS */
|
||||
period = 0x002e, /* U+002E FULL STOP */
|
||||
slash = 0x002f, /* U+002F SOLIDUS */
|
||||
Number0 = 0x0030, /* U+0030 DIGIT ZERO */
|
||||
Number1 = 0x0031, /* U+0031 DIGIT ONE */
|
||||
Number2 = 0x0032, /* U+0032 DIGIT TWO */
|
||||
Number3 = 0x0033, /* U+0033 DIGIT THREE */
|
||||
Number4 = 0x0034, /* U+0034 DIGIT FOUR */
|
||||
Number5 = 0x0035, /* U+0035 DIGIT FIVE */
|
||||
Number6 = 0x0036, /* U+0036 DIGIT SIX */
|
||||
Number7 = 0x0037, /* U+0037 DIGIT SEVEN */
|
||||
Number8 = 0x0038, /* U+0038 DIGIT EIGHT */
|
||||
Number9 = 0x0039, /* U+0039 DIGIT NINE */
|
||||
colon = 0x003a, /* U+003A COLON */
|
||||
semicolon = 0x003b, /* U+003B SEMICOLON */
|
||||
less = 0x003c, /* U+003C LESS-THAN SIGN */
|
||||
equal = 0x003d, /* U+003D EQUALS SIGN */
|
||||
greater = 0x003e, /* U+003E GREATER-THAN SIGN */
|
||||
question = 0x003f, /* U+003F QUESTION MARK */
|
||||
at = 0x0040, /* U+0040 COMMERCIAL AT */
|
||||
A = 0x0041, /* U+0041 LATIN CAPITAL LETTER A */
|
||||
Z = 0x005a, /* U+005A LATIN CAPITAL LETTER Z */
|
||||
bracketleft = 0x005b, /* U+005B LEFT SQUARE BRACKET */
|
||||
backslash = 0x005c, /* U+005C REVERSE SOLIDUS */
|
||||
bracketright = 0x005d, /* U+005D RIGHT SQUARE BRACKET */
|
||||
asciicircum = 0x005e, /* U+005E CIRCUMFLEX ACCENT */
|
||||
underscore = 0x005f, /* U+005F LOW LINE */
|
||||
grave = 0x0060, /* U+0060 GRAVE ACCENT */
|
||||
quoteleft = 0x0060, /* deprecated */
|
||||
a = 0x0061, /* U+0061 LATIN SMALL LETTER A */
|
||||
z = 0x007a, /* U+007A LATIN SMALL LETTER Z */
|
||||
braceleft = 0x007b, /* U+007B LEFT CURLY BRACKET */
|
||||
bar = 0x007c, /* U+007C VERTICAL LINE */
|
||||
braceright = 0x007d, /* U+007D RIGHT CURLY BRACKET */
|
||||
asciitilde = 0x007e, /* U+007E TILDE */
|
||||
}
|
||||
|
||||
public enum XVisualClass : int {
|
||||
StaticGray = 0,
|
||||
GrayScale = 1,
|
||||
StaticColor = 2,
|
||||
PseudoColor = 3,
|
||||
TrueColor = 4,
|
||||
DirectColor = 5,
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning restore 3019
|
||||
#pragma warning restore 0649
|
||||
#pragma warning restore 0169
|
||||
#region --- License ---
|
||||
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
|
||||
* Contributions from Erik Ylvisaker
|
||||
* See license.txt for license info
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#pragma warning disable 3019 // CLS-compliance checking
|
||||
#pragma warning disable 0649 // struct members not explicitly initialized
|
||||
#pragma warning disable 0169 // field / method is never used.
|
||||
#pragma warning disable 0414 // field assigned but never used.
|
||||
|
||||
namespace OpenTK.Platform.X11 {
|
||||
|
||||
using Window = System.IntPtr;
|
||||
using VisualID = System.IntPtr;
|
||||
using Display = System.IntPtr;
|
||||
using Bool = System.Boolean;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct XVisualInfo {
|
||||
public IntPtr Visual;
|
||||
public VisualID VisualID;
|
||||
public int Screen;
|
||||
public int Depth;
|
||||
public XVisualClass Class;
|
||||
public long RedMask;
|
||||
public long GreenMask;
|
||||
public long blueMask;
|
||||
public int ColormapSize;
|
||||
public int BitsPerRgb;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct XRRScreenSize {
|
||||
internal int Width, Height;
|
||||
internal int MWidth, MHeight;
|
||||
}
|
||||
|
||||
internal enum ErrorCodes : int {
|
||||
Success = 0,
|
||||
BadRequest = 1,
|
||||
BadValue = 2,
|
||||
BadWindow = 3,
|
||||
BadPixmap = 4,
|
||||
BadAtom = 5,
|
||||
BadCursor = 6,
|
||||
BadFont = 7,
|
||||
BadMatch = 8,
|
||||
BadDrawable = 9,
|
||||
BadAccess = 10,
|
||||
BadAlloc = 11,
|
||||
BadColor = 12,
|
||||
BadGC = 13,
|
||||
BadIDChoice = 14,
|
||||
BadName = 15,
|
||||
BadLength = 16,
|
||||
BadImplementation = 17,
|
||||
}
|
||||
|
||||
/// <summary> Defines LATIN-1 and miscellaneous keys. </summary>
|
||||
internal enum XKey {
|
||||
/* TTY function keys, cleverly chosen to map to ASCII, for convenience of
|
||||
* programming, but could have been arbitrary (at the cost of lookup
|
||||
* tables in client code). */
|
||||
|
||||
BackSpace = 0xff08, /* Back space, back char */
|
||||
Tab = 0xff09,
|
||||
Linefeed = 0xff0a, /* Linefeed, LF */
|
||||
Clear = 0xff0b,
|
||||
Return = 0xff0d, /* Return, enter */
|
||||
Pause = 0xff13, /* Pause, hold */
|
||||
Scroll_Lock = 0xff14,
|
||||
Sys_Req = 0xff15,
|
||||
Escape = 0xff1b,
|
||||
Delete = 0xffff, /* Delete, rubout */
|
||||
|
||||
/* Cursor control & motion */
|
||||
Home = 0xff50,
|
||||
Left = 0xff51, /* Move left, left arrow */
|
||||
Up = 0xff52, /* Move up, up arrow */
|
||||
Right = 0xff53, /* Move right, right arrow */
|
||||
Down = 0xff54, /* Move down, down arrow */
|
||||
Page_Up = 0xff55,
|
||||
Page_Down = 0xff56,
|
||||
End = 0xff57, /* EOL */
|
||||
|
||||
/* Misc functions */
|
||||
Print = 0xff61,
|
||||
Insert = 0xff63, /* Insert, insert here */
|
||||
Menu = 0xff67,
|
||||
Break = 0xff6b,
|
||||
Num_Lock = 0xff7f,
|
||||
|
||||
/* Keypad functions, keypad numbers cleverly chosen to map to ASCII */
|
||||
KP_Space = 0xff80, /* Space */
|
||||
KP_Tab = 0xff89,
|
||||
KP_Enter = 0xff8d, /* Enter */
|
||||
KP_F1 = 0xff91, /* PF1, KP_A, ... */
|
||||
KP_F2 = 0xff92,
|
||||
KP_F3 = 0xff93,
|
||||
KP_F4 = 0xff94,
|
||||
KP_Home = 0xff95,
|
||||
KP_Left = 0xff96,
|
||||
KP_Up = 0xff97,
|
||||
KP_Right = 0xff98,
|
||||
KP_Down = 0xff99,
|
||||
KP_Prior = 0xff9a,
|
||||
KP_Page_Up = 0xff9a,
|
||||
KP_Next = 0xff9b,
|
||||
KP_Page_Down = 0xff9b,
|
||||
KP_End = 0xff9c,
|
||||
KP_Begin = 0xff9d,
|
||||
KP_Insert = 0xff9e,
|
||||
KP_Delete = 0xff9f,
|
||||
KP_Equal = 0xffbd, /* Equals */
|
||||
KP_Multiply = 0xffaa,
|
||||
KP_Add = 0xffab,
|
||||
KP_Separator = 0xffac, /* Separator, often comma */
|
||||
KP_Subtract = 0xffad,
|
||||
KP_Decimal = 0xffae,
|
||||
KP_Divide = 0xffaf,
|
||||
|
||||
KP_0 = 0xffb0,
|
||||
KP_9 = 0xffb9,
|
||||
|
||||
/*
|
||||
* Auxiliary functions; note the duplicate definitions for left and right
|
||||
* function keys; Sun keyboards and a few other manufacturers have such
|
||||
* function key groups on the left and/or right sides of the keyboard.
|
||||
* We've not found a keyboard with more than 35 function keys total.
|
||||
*/
|
||||
F1 = 0xffbe,
|
||||
F35 = 0xffe0,
|
||||
|
||||
/* Modifiers */
|
||||
|
||||
Shift_L = 0xffe1, /* Left shift */
|
||||
Shift_R = 0xffe2, /* Right shift */
|
||||
Control_L = 0xffe3, /* Left control */
|
||||
Control_R = 0xffe4, /* Right control */
|
||||
Caps_Lock = 0xffe5, /* Caps lock */
|
||||
Shift_Lock = 0xffe6, /* Shift lock */
|
||||
|
||||
Meta_L = 0xffe7, /* Left meta */
|
||||
Meta_R = 0xffe8, /* Right meta */
|
||||
Alt_L = 0xffe9, /* Left alt */
|
||||
Alt_R = 0xffea, /* Right alt */
|
||||
Super_L = 0xffeb, /* Left super */
|
||||
Super_R = 0xffec, /* Right super */
|
||||
|
||||
/*
|
||||
* Latin 1
|
||||
* (ISO/IEC 8859-1 = Unicode U+0020..U+00FF)
|
||||
* Byte 3 = 0
|
||||
*/
|
||||
|
||||
space = 0x0020, /* U+0020 SPACE */
|
||||
exclam = 0x0021, /* U+0021 EXCLAMATION MARK */
|
||||
quotedbl = 0x0022, /* U+0022 QUOTATION MARK */
|
||||
numbersign = 0x0023, /* U+0023 NUMBER SIGN */
|
||||
dollar = 0x0024, /* U+0024 DOLLAR SIGN */
|
||||
percent = 0x0025, /* U+0025 PERCENT SIGN */
|
||||
ampersand = 0x0026, /* U+0026 AMPERSAND */
|
||||
apostrophe = 0x0027, /* U+0027 APOSTROPHE */
|
||||
quoteright = 0x0027, /* deprecated */
|
||||
parenleft = 0x0028, /* U+0028 LEFT PARENTHESIS */
|
||||
parenright = 0x0029, /* U+0029 RIGHT PARENTHESIS */
|
||||
asterisk = 0x002a, /* U+002A ASTERISK */
|
||||
plus = 0x002b, /* U+002B PLUS SIGN */
|
||||
comma = 0x002c, /* U+002C COMMA */
|
||||
minus = 0x002d, /* U+002D HYPHEN-MINUS */
|
||||
period = 0x002e, /* U+002E FULL STOP */
|
||||
slash = 0x002f, /* U+002F SOLIDUS */
|
||||
Number0 = 0x0030, /* U+0030 DIGIT ZERO */
|
||||
Number1 = 0x0031, /* U+0031 DIGIT ONE */
|
||||
Number2 = 0x0032, /* U+0032 DIGIT TWO */
|
||||
Number3 = 0x0033, /* U+0033 DIGIT THREE */
|
||||
Number4 = 0x0034, /* U+0034 DIGIT FOUR */
|
||||
Number5 = 0x0035, /* U+0035 DIGIT FIVE */
|
||||
Number6 = 0x0036, /* U+0036 DIGIT SIX */
|
||||
Number7 = 0x0037, /* U+0037 DIGIT SEVEN */
|
||||
Number8 = 0x0038, /* U+0038 DIGIT EIGHT */
|
||||
Number9 = 0x0039, /* U+0039 DIGIT NINE */
|
||||
colon = 0x003a, /* U+003A COLON */
|
||||
semicolon = 0x003b, /* U+003B SEMICOLON */
|
||||
less = 0x003c, /* U+003C LESS-THAN SIGN */
|
||||
equal = 0x003d, /* U+003D EQUALS SIGN */
|
||||
greater = 0x003e, /* U+003E GREATER-THAN SIGN */
|
||||
question = 0x003f, /* U+003F QUESTION MARK */
|
||||
at = 0x0040, /* U+0040 COMMERCIAL AT */
|
||||
A = 0x0041, /* U+0041 LATIN CAPITAL LETTER A */
|
||||
Z = 0x005a, /* U+005A LATIN CAPITAL LETTER Z */
|
||||
bracketleft = 0x005b, /* U+005B LEFT SQUARE BRACKET */
|
||||
backslash = 0x005c, /* U+005C REVERSE SOLIDUS */
|
||||
bracketright = 0x005d, /* U+005D RIGHT SQUARE BRACKET */
|
||||
asciicircum = 0x005e, /* U+005E CIRCUMFLEX ACCENT */
|
||||
underscore = 0x005f, /* U+005F LOW LINE */
|
||||
grave = 0x0060, /* U+0060 GRAVE ACCENT */
|
||||
quoteleft = 0x0060, /* deprecated */
|
||||
a = 0x0061, /* U+0061 LATIN SMALL LETTER A */
|
||||
z = 0x007a, /* U+007A LATIN SMALL LETTER Z */
|
||||
braceleft = 0x007b, /* U+007B LEFT CURLY BRACKET */
|
||||
bar = 0x007c, /* U+007C VERTICAL LINE */
|
||||
braceright = 0x007d, /* U+007D RIGHT CURLY BRACKET */
|
||||
asciitilde = 0x007e, /* U+007E TILDE */
|
||||
}
|
||||
|
||||
public enum XVisualClass : int {
|
||||
StaticGray = 0,
|
||||
GrayScale = 1,
|
||||
StaticColor = 2,
|
||||
PseudoColor = 3,
|
||||
TrueColor = 4,
|
||||
DirectColor = 5,
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning restore 3019
|
||||
#pragma warning restore 0649
|
||||
#pragma warning restore 0169
|
||||
#pragma warning restore 0414
|
@ -635,34 +635,6 @@ namespace OpenTK.Platform.X11
|
||||
public IntPtr cursor;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct XWindowAttributes
|
||||
{
|
||||
public int x;
|
||||
public int y;
|
||||
public int width;
|
||||
public int height;
|
||||
public int border_width;
|
||||
public int depth;
|
||||
public IntPtr visual;
|
||||
public IntPtr root;
|
||||
public int c_class;
|
||||
public Gravity bit_gravity;
|
||||
public Gravity win_gravity;
|
||||
public int backing_store;
|
||||
public IntPtr backing_planes;
|
||||
public IntPtr backing_pixel;
|
||||
public bool save_under;
|
||||
public IntPtr colormap;
|
||||
public bool map_installed;
|
||||
public MapState map_state;
|
||||
public IntPtr all_event_masks;
|
||||
public IntPtr your_event_mask;
|
||||
public IntPtr do_not_propagate_mask;
|
||||
public bool override_direct;
|
||||
public IntPtr screen;
|
||||
}
|
||||
|
||||
public enum XEventName
|
||||
{
|
||||
KeyPress = 2,
|
||||
@ -1105,101 +1077,6 @@ namespace OpenTK.Platform.X11
|
||||
IsViewable = 2
|
||||
}
|
||||
|
||||
public enum CursorFontShape
|
||||
{
|
||||
XC_X_cursor = 0,
|
||||
XC_arrow = 2,
|
||||
XC_based_arrow_down = 4,
|
||||
XC_based_arrow_up = 6,
|
||||
XC_boat = 8,
|
||||
XC_bogosity = 10,
|
||||
XC_bottom_left_corner = 12,
|
||||
XC_bottom_right_corner = 14,
|
||||
XC_bottom_side = 16,
|
||||
XC_bottom_tee = 18,
|
||||
XC_box_spiral = 20,
|
||||
XC_center_ptr = 22,
|
||||
|
||||
XC_circle = 24,
|
||||
XC_clock = 26,
|
||||
XC_coffee_mug = 28,
|
||||
XC_cross = 30,
|
||||
XC_cross_reverse = 32,
|
||||
XC_crosshair = 34,
|
||||
XC_diamond_cross = 36,
|
||||
XC_dot = 38,
|
||||
XC_dotbox = 40,
|
||||
XC_double_arrow = 42,
|
||||
XC_draft_large = 44,
|
||||
XC_draft_small = 46,
|
||||
|
||||
XC_draped_box = 48,
|
||||
XC_exchange = 50,
|
||||
XC_fleur = 52,
|
||||
XC_gobbler = 54,
|
||||
XC_gumby = 56,
|
||||
XC_hand1 = 58,
|
||||
XC_hand2 = 60,
|
||||
XC_heart = 62,
|
||||
XC_icon = 64,
|
||||
XC_iron_cross = 66,
|
||||
XC_left_ptr = 68,
|
||||
XC_left_side = 70,
|
||||
|
||||
XC_left_tee = 72,
|
||||
XC_left_button = 74,
|
||||
XC_ll_angle = 76,
|
||||
XC_lr_angle = 78,
|
||||
XC_man = 80,
|
||||
XC_middlebutton = 82,
|
||||
XC_mouse = 84,
|
||||
XC_pencil = 86,
|
||||
XC_pirate = 88,
|
||||
XC_plus = 90,
|
||||
XC_question_arrow = 92,
|
||||
XC_right_ptr = 94,
|
||||
|
||||
XC_right_side = 96,
|
||||
XC_right_tee = 98,
|
||||
XC_rightbutton = 100,
|
||||
XC_rtl_logo = 102,
|
||||
XC_sailboat = 104,
|
||||
XC_sb_down_arrow = 106,
|
||||
XC_sb_h_double_arrow = 108,
|
||||
XC_sb_left_arrow = 110,
|
||||
XC_sb_right_arrow = 112,
|
||||
XC_sb_up_arrow = 114,
|
||||
XC_sb_v_double_arrow = 116,
|
||||
XC_sb_shuttle = 118,
|
||||
|
||||
XC_sizing = 120,
|
||||
XC_spider = 122,
|
||||
XC_spraycan = 124,
|
||||
XC_star = 126,
|
||||
XC_target = 128,
|
||||
XC_tcross = 130,
|
||||
XC_top_left_arrow = 132,
|
||||
XC_top_left_corner = 134,
|
||||
XC_top_right_corner = 136,
|
||||
XC_top_side = 138,
|
||||
XC_top_tee = 140,
|
||||
XC_trek = 142,
|
||||
|
||||
XC_ul_angle = 144,
|
||||
XC_umbrella = 146,
|
||||
XC_ur_angle = 148,
|
||||
XC_watch = 150,
|
||||
XC_xterm = 152,
|
||||
XC_num_glyphs = 154
|
||||
}
|
||||
|
||||
public enum SystrayRequest
|
||||
{
|
||||
SYSTEM_TRAY_REQUEST_DOCK = 0,
|
||||
SYSTEM_TRAY_BEGIN_MESSAGE = 1,
|
||||
SYSTEM_TRAY_CANCEL_MESSAGE = 2
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum XSizeHintsFlags
|
||||
{
|
||||
@ -1410,20 +1287,6 @@ namespace OpenTK.Platform.X11
|
||||
X_NoOperation = 127
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum XIMProperties
|
||||
{
|
||||
XIMPreeditArea = 0x0001,
|
||||
XIMPreeditCallbacks = 0x0002,
|
||||
XIMPreeditPosition = 0x0004,
|
||||
XIMPreeditNothing = 0x0008,
|
||||
XIMPreeditNone = 0x0010,
|
||||
XIMStatusArea = 0x0100,
|
||||
XIMStatusCallbacks = 0x0200,
|
||||
XIMStatusNothing = 0x0400,
|
||||
XIMStatusNone = 0x0800,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum WindowType
|
||||
{
|
||||
@ -1432,24 +1295,6 @@ namespace OpenTK.Platform.X11
|
||||
Both = 3
|
||||
}
|
||||
|
||||
public enum XEmbedMessage
|
||||
{
|
||||
EmbeddedNotify = 0,
|
||||
WindowActivate = 1,
|
||||
WindowDeactivate = 2,
|
||||
RequestFocus = 3,
|
||||
FocusIn = 4,
|
||||
FocusOut = 5,
|
||||
FocusNext = 6,
|
||||
FocusPrev = 7,
|
||||
/* 8-9 were used for XEMBED_GRAB_KEY/XEMBED_UNGRAB_KEY */
|
||||
ModalityOn = 10,
|
||||
ModalityOff = 11,
|
||||
RegisterAccelerator = 12,
|
||||
UnregisterAccelerator = 13,
|
||||
ActivateAccelerator = 14
|
||||
}
|
||||
|
||||
public enum ImageFormat
|
||||
{
|
||||
XYPixmap = 1,
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "Platform.h"
|
||||
#include "Deflate.h"
|
||||
#include "Stream.h"
|
||||
#include "Funcs.h"
|
||||
|
||||
/*########################################################################################################################*
|
||||
*--------------------------------------------------------ZipEntry---------------------------------------------------------*
|
||||
@ -118,13 +119,13 @@ void Zip_Init(ZipState* state, Stream* input) {
|
||||
void Zip_Extract(ZipState* state) {
|
||||
state->EntriesCount = 0;
|
||||
Stream* stream = state->Input;
|
||||
ReturnCode result;
|
||||
UInt32 sig = 0;
|
||||
UInt32 sig = 0, stream_len = 0;
|
||||
ReturnCode result = stream->Length(stream, &stream_len);
|
||||
|
||||
/* At -22 for nearly all zips, but try a bit further back in case of comment */
|
||||
Int32 i;
|
||||
for (i = -22; i >= -256; i--) {
|
||||
result = stream->Seek(stream, i, STREAM_SEEKFROM_END);
|
||||
Int32 i, len = min(257, stream_len);
|
||||
for (i = 22; i < len; i++) {
|
||||
result = stream->Seek(stream, -i, STREAM_SEEKFROM_END);
|
||||
ErrorHandler_CheckOrFail(result, "ZIP - Seek to end of central directory");
|
||||
sig = Stream_ReadU32_LE(stream);
|
||||
if (sig == ZIP_ENDOFCENTRALDIR) break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user