/* Class429 - Decompiled by JODE
 * Visit http://jode.sourceforge.net/
 */
import java.awt.DisplayMode;
import java.awt.Frame;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.lang.reflect.Field;

public class Class429 {
	GraphicsDevice aGraphicsDevice6216;
	DisplayMode aDisplayMode6217;

	void method7734(Frame frame, byte i) {
		boolean bool = false;
		try {
			Field field = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("valid");
			field.setAccessible(true);
			boolean bool_0_ = ((Boolean) field.get(((Class429) this).aGraphicsDevice6216)).booleanValue();
			if (bool_0_) {
				field.set(((Class429) this).aGraphicsDevice6216, Boolean.FALSE);
				bool = true;
			}
		} catch (Throwable throwable) {
			/* empty */
		}
		try {
			((Class429) this).aGraphicsDevice6216.setFullScreenWindow(frame);
			if (bool) {
				try {
					Field field = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("valid");
					field.set(((Class429) this).aGraphicsDevice6216, Boolean.TRUE);
				} catch (Throwable throwable) {
					/* empty */
				}
			}
		} catch (Exception object) {
			if (bool) {
				try {
					Field field = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("valid");
					field.set(((Class429) this).aGraphicsDevice6216, Boolean.TRUE);
				} catch (Throwable throwable) {
					/* empty */
				}
			}
			throw object;
		}
	}

	void method7735(Frame frame, int i, int i_1_, int i_2_, int i_3_) {
		((Class429) this).aDisplayMode6217 = ((Class429) this).aGraphicsDevice6216.getDisplayMode();
		if (((Class429) this).aDisplayMode6217 == null)
			throw new NullPointerException();
		frame.setUndecorated(true);
		frame.enableInputMethods(false);
		method7734(frame, (byte) 59);
		if (i_3_ == 0) {
			int i_4_ = ((Class429) this).aDisplayMode6217.getRefreshRate();
			DisplayMode[] displaymodes = ((Class429) this).aGraphicsDevice6216.getDisplayModes();
			boolean bool = false;
			for (int i_5_ = 0; i_5_ < displaymodes.length; i_5_++) {
				if (displaymodes[i_5_].getWidth() == i && displaymodes[i_5_].getHeight() == i_1_ && displaymodes[i_5_].getBitDepth() == i_2_) {
					int i_6_ = displaymodes[i_5_].getRefreshRate();
					if (!bool || Math.abs(i_6_ - i_4_) < Math.abs(i_3_ - i_4_)) {
						i_3_ = i_6_;
						bool = true;
					}
				}
			}
			if (!bool)
				i_3_ = i_4_;
		}
		((Class429) this).aGraphicsDevice6216.setDisplayMode(new DisplayMode(i, i_1_, i_2_, i_3_));
	}

	void method7736(Frame frame, int i, int i_7_, int i_8_, int i_9_, int i_10_) {
		((Class429) this).aDisplayMode6217 = ((Class429) this).aGraphicsDevice6216.getDisplayMode();
		if (((Class429) this).aDisplayMode6217 == null)
			throw new NullPointerException();
		frame.setUndecorated(true);
		frame.enableInputMethods(false);
		method7734(frame, (byte) 5);
		if (i_9_ == 0) {
			int i_11_ = ((Class429) this).aDisplayMode6217.getRefreshRate();
			DisplayMode[] displaymodes = ((Class429) this).aGraphicsDevice6216.getDisplayModes();
			boolean bool = false;
			for (int i_12_ = 0; i_12_ < displaymodes.length; i_12_++) {
				if (displaymodes[i_12_].getWidth() == i && displaymodes[i_12_].getHeight() == i_7_ && displaymodes[i_12_].getBitDepth() == i_8_) {
					int i_13_ = displaymodes[i_12_].getRefreshRate();
					if (!bool || Math.abs(i_13_ - i_11_) < Math.abs(i_9_ - i_11_)) {
						i_9_ = i_13_;
						bool = true;
					}
				}
			}
			if (!bool)
				i_9_ = i_11_;
		}
		((Class429) this).aGraphicsDevice6216.setDisplayMode(new DisplayMode(i, i_7_, i_8_, i_9_));
	}

	int[] method7737(int i) {
		DisplayMode[] displaymodes = ((Class429) this).aGraphicsDevice6216.getDisplayModes();
		int[] is = new int[displaymodes.length << 2];
		for (int i_14_ = 0; i_14_ < displaymodes.length; i_14_++) {
			is[i_14_ << 2] = displaymodes[i_14_].getWidth();
			is[(i_14_ << 2) + 1] = displaymodes[i_14_].getHeight();
			is[2 + (i_14_ << 2)] = displaymodes[i_14_].getBitDepth();
			is[(i_14_ << 2) + 3] = displaymodes[i_14_].getRefreshRate();
		}
		return is;
	}

	void method7738(int i) {
		if (((Class429) this).aDisplayMode6217 != null) {
			DisplayMode[] displaymodes = ((Class429) this).aGraphicsDevice6216.getDisplayModes();
			boolean bool = false;
			DisplayMode[] displaymodes_15_ = displaymodes;
			for (int i_16_ = 0; i_16_ < displaymodes_15_.length; i_16_++) {
				DisplayMode displaymode = displaymodes_15_[i_16_];
				if (displaymode.equals(((Class429) this).aDisplayMode6217)) {
					((Class429) this).aGraphicsDevice6216.setDisplayMode(((Class429) this).aDisplayMode6217);
					bool = true;
					break;
				}
			}
			if (!bool) {
				try {
					Field field = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("defaultDisplayMode");
					field.setAccessible(true);
					field.set(((Class429) this).aGraphicsDevice6216, null);
				} catch (Throwable throwable) {
					/* empty */
				}
			}
			((Class429) this).aDisplayMode6217 = null;
		}
		method7734(null, (byte) 31);
	}

	void method7739(Frame frame, int i, int i_17_, int i_18_, int i_19_) {
		((Class429) this).aDisplayMode6217 = ((Class429) this).aGraphicsDevice6216.getDisplayMode();
		if (((Class429) this).aDisplayMode6217 == null)
			throw new NullPointerException();
		frame.setUndecorated(true);
		frame.enableInputMethods(false);
		method7734(frame, (byte) 55);
		if (i_19_ == 0) {
			int i_20_ = ((Class429) this).aDisplayMode6217.getRefreshRate();
			DisplayMode[] displaymodes = ((Class429) this).aGraphicsDevice6216.getDisplayModes();
			boolean bool = false;
			for (int i_21_ = 0; i_21_ < displaymodes.length; i_21_++) {
				if (displaymodes[i_21_].getWidth() == i && displaymodes[i_21_].getHeight() == i_17_ && displaymodes[i_21_].getBitDepth() == i_18_) {
					int i_22_ = displaymodes[i_21_].getRefreshRate();
					if (!bool || Math.abs(i_22_ - i_20_) < Math.abs(i_19_ - i_20_)) {
						i_19_ = i_22_;
						bool = true;
					}
				}
			}
			if (!bool)
				i_19_ = i_20_;
		}
		((Class429) this).aGraphicsDevice6216.setDisplayMode(new DisplayMode(i, i_17_, i_18_, i_19_));
	}

	void method7740(Frame frame, int i, int i_23_, int i_24_, int i_25_) {
		((Class429) this).aDisplayMode6217 = ((Class429) this).aGraphicsDevice6216.getDisplayMode();
		if (((Class429) this).aDisplayMode6217 == null)
			throw new NullPointerException();
		frame.setUndecorated(true);
		frame.enableInputMethods(false);
		method7734(frame, (byte) 121);
		if (i_25_ == 0) {
			int i_26_ = ((Class429) this).aDisplayMode6217.getRefreshRate();
			DisplayMode[] displaymodes = ((Class429) this).aGraphicsDevice6216.getDisplayModes();
			boolean bool = false;
			for (int i_27_ = 0; i_27_ < displaymodes.length; i_27_++) {
				if (displaymodes[i_27_].getWidth() == i && displaymodes[i_27_].getHeight() == i_23_ && displaymodes[i_27_].getBitDepth() == i_24_) {
					int i_28_ = displaymodes[i_27_].getRefreshRate();
					if (!bool || Math.abs(i_28_ - i_26_) < Math.abs(i_25_ - i_26_)) {
						i_25_ = i_28_;
						bool = true;
					}
				}
			}
			if (!bool)
				i_25_ = i_26_;
		}
		((Class429) this).aGraphicsDevice6216.setDisplayMode(new DisplayMode(i, i_23_, i_24_, i_25_));
	}

	void method7741() {
		if (((Class429) this).aDisplayMode6217 != null) {
			DisplayMode[] displaymodes = ((Class429) this).aGraphicsDevice6216.getDisplayModes();
			boolean bool = false;
			DisplayMode[] displaymodes_29_ = displaymodes;
			for (int i = 0; i < displaymodes_29_.length; i++) {
				DisplayMode displaymode = displaymodes_29_[i];
				if (displaymode.equals(((Class429) this).aDisplayMode6217)) {
					((Class429) this).aGraphicsDevice6216.setDisplayMode(((Class429) this).aDisplayMode6217);
					bool = true;
					break;
				}
			}
			if (!bool) {
				try {
					Field field = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("defaultDisplayMode");
					field.setAccessible(true);
					field.set(((Class429) this).aGraphicsDevice6216, null);
				} catch (Throwable throwable) {
					/* empty */
				}
			}
			((Class429) this).aDisplayMode6217 = null;
		}
		method7734(null, (byte) 82);
	}

	void method7742() {
		if (((Class429) this).aDisplayMode6217 != null) {
			DisplayMode[] displaymodes = ((Class429) this).aGraphicsDevice6216.getDisplayModes();
			boolean bool = false;
			DisplayMode[] displaymodes_30_ = displaymodes;
			for (int i = 0; i < displaymodes_30_.length; i++) {
				DisplayMode displaymode = displaymodes_30_[i];
				if (displaymode.equals(((Class429) this).aDisplayMode6217)) {
					((Class429) this).aGraphicsDevice6216.setDisplayMode(((Class429) this).aDisplayMode6217);
					bool = true;
					break;
				}
			}
			if (!bool) {
				try {
					Field field = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("defaultDisplayMode");
					field.setAccessible(true);
					field.set(((Class429) this).aGraphicsDevice6216, null);
				} catch (Throwable throwable) {
					/* empty */
				}
			}
			((Class429) this).aDisplayMode6217 = null;
		}
		method7734(null, (byte) 94);
	}

	public Class429() throws Exception {
		GraphicsEnvironment graphicsenvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
		((Class429) this).aGraphicsDevice6216 = graphicsenvironment.getDefaultScreenDevice();
		if (!((Class429) this).aGraphicsDevice6216.isFullScreenSupported()) {
			GraphicsDevice[] graphicsdevices = graphicsenvironment.getScreenDevices();
			GraphicsDevice[] graphicsdevices_31_ = graphicsdevices;
			for (int i = 0; i < graphicsdevices_31_.length; i++) {
				GraphicsDevice graphicsdevice = graphicsdevices_31_[i];
				if (null != graphicsdevice && graphicsdevice.isFullScreenSupported()) {
					((Class429) this).aGraphicsDevice6216 = graphicsdevice;
					return;
				}
			}
			throw new Exception();
		}
	}

	void method7743(Frame frame) {
		boolean bool = false;
		try {
			Field field = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("valid");
			field.setAccessible(true);
			boolean bool_32_ = ((Boolean) field.get(((Class429) this).aGraphicsDevice6216)).booleanValue();
			if (bool_32_) {
				field.set(((Class429) this).aGraphicsDevice6216, Boolean.FALSE);
				bool = true;
			}
		} catch (Throwable throwable) {
			/* empty */
		}
		try {
			((Class429) this).aGraphicsDevice6216.setFullScreenWindow(frame);
			if (bool) {
				try {
					Field field = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("valid");
					field.set(((Class429) this).aGraphicsDevice6216, Boolean.TRUE);
				} catch (Throwable throwable) {
					/* empty */
				}
			}
		} catch (Exception object) {
			if (bool) {
				try {
					Field field = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("valid");
					field.set(((Class429) this).aGraphicsDevice6216, Boolean.TRUE);
				} catch (Throwable throwable) {
					/* empty */
				}
			}
			throw object;
		}
	}

	static final void method7744(int i, int[] is, int i_33_) {
		if (Class588.method12794(i, is, -1926014914)) {
			Class35[] class35s = Class35.aClass118Array464[i].aClass35Array1648;
			for (int i_34_ = 0; i_34_ < class35s.length; i_34_++) {
				Class35 class35 = class35s[i_34_];
				if (class35 != null && null != class35.aClass436_610)
					class35.aClass436_610.method7878((byte) 127);
			}
		}
	}
}
