gt: 			cw.write("winloc " + winloc.x + " " + winloc.y + "\r\n");
context: package com.pixelutilitys.arcade.emulators.AEPgb;
  
  /**
   * this source file released under the GNU Public Licence.
   * see the accompanying copyright.txt for more information.
   * Copyright (C) 2000-2001 Ben Mazur
   * modified by retroK 2004 http://aep-emu.de/
   */
  
  import java.awt.Button;
  import java.awt.Dialog;
  import java.awt.Frame;
  import java.awt.GridLayout;
  import java.awt.Label;
  import java.awt.LayoutManager;
  import java.awt.Point;
  import java.awt.TextField;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  import java.awt.event.KeyEvent;
  import java.awt.event.KeyListener;
  import java.io.File;
  import java.io.FileReader;
  import java.io.FileWriter;
  import java.io.Reader;
  import java.io.StreamTokenizer;
  import java.io.Writer;
  
  /**
   * PgbSettings is a static class containing all the settings 
   * that the various components need to operate.
   * 
   * Remember to recompile all dependent classes if you change
   * DEBUG for it to take effect.
   */
  public class PgbSettings {
  	public static final boolean		DEBUG = false;
  	
  	public static final String		emulator = "Pgb";
  	public static final String		version = "0.89.2";
  
  	public static final int			SYS_GB	= 00; /* gameboy classic	*/
  	public static final int			SYS_GBP	= 01; /* gameboy pocket		*/
  	public static final int			SYS_SGB	= 10; /* super gameboy		*/
  	public static final int			SYS_GBC	= 11; /* gameboy color		*/
  	
  	public static final int			VIDOUT_DEFAULT	= 00;
  	public static final int			VIDOUT_DIRECTX	= 01;
  	public static final int			VIDOUT_INDEXED	= 02;
  	public static final int			VIDOUT_DIRECT	= 03;
  	
  	public volatile static boolean	paused = false;
  	public volatile static boolean	active = false;
  	
  	public static int				priority = Thread.NORM_PRIORITY;
  	
  	public static boolean			usedirectx = false;
  	
  	public static int				debuglevel = 0;
  	public static int				debugstop = -1;
  	
  	public static int				videooutput = VIDOUT_DIRECT;
  	
  	public static int				desiredsystem = SYS_GBC;
  	public static int				system;
  	
  	public static int				lcdsize = 2;
  	public static boolean			autowait = true;
  	public static int				frameskip = 0;
  	public static double			clockspeed = 4.194304;
  	
  	public static int				key_up		= KeyEvent.VK_UP;
  	public static int				key_down	= KeyEvent.VK_DOWN;
  	public static int				key_left	= KeyEvent.VK_LEFT;
  	public static int				key_right	= KeyEvent.VK_RIGHT;
  	public static int				key_a		= KeyEvent.VK_A;
  	public static int				key_b		= KeyEvent.VK_S;
  	public static int				key_select	= KeyEvent.VK_SPACE;
  	public static int				key_start	= KeyEvent.VK_ENTER;
  	public static int				key_screen  = KeyEvent.VK_F5;
  	
  	public static int[]				bgcolors = {0xFFFFFFFF, 0xFFDAA5AE, 0xFFA24051, 0xFF000000};
  	public static int[]				obj0colors = {0xFFFFFFFF, 0xFF95D5A4, 0xFF579629, 0xFF000000};
  	public static int[]				obj1colors = {0xFFFFFFFF, 0xFF92C0E7, 0xFF2F7ED0, 0xFF000000};
  	
  	public static boolean			sgbborder = false;
  	public static boolean			colormute = false;
  	// by retroK
  	public static boolean			usesound = true;
  
  	
  	public static String			gamestring = "NONE            ";
  	public static String			lastnetaddress = "";
  	public static int				netlistentimeout = 10000;
  	public static int				netport = 2907;
  	
  	public static Point				winloc = new Point();
  	
  	public static void popKeysDialog(Frame frame) {
  		PgbKeyDialog kd;
  		
  		kd = new PgbKeyDialog(frame);
  		kd.setVisible(true);
  	}
  	
  	public static void load() {
  		File cfgfile;
  		Reader cr;
  		StreamTokenizer st;
  		String key;
  		
  		// read, read, read!
  		try {
  			cfgfile = new File("Pgb.cfg");
  			if(!cfgfile.exists()) {
  				return;
  			}
  			cr = new FileReader(cfgfile);
  			st = new StreamTokenizer(cr);
  
  			st.lowerCaseMode(true);
  			st.quoteChar('"');
  			st.commentChar('#');
  
  scan:
  			while(true) {
  				switch(st.nextToken()) {
  				case StreamTokenizer.TT_EOF:
  					break scan;
  				case StreamTokenizer.TT_EOL:
  					break scan;
  				case StreamTokenizer.TT_WORD:
  					// read in 
  					key = st.sval;
  					if(key.equals("winloc")) {
  						winloc = new Point();
  						st.nextToken();
  						winloc.x = (int)st.nval;
  						st.nextToken();
  						winloc.y = (int)st.nval;
  					}
  					if(key.equals("lcdsize")) {
  						st.nextToken();
  						lcdsize = (int)st.nval;
  					}
  					if(key.equals("frameskip")) {
  						st.nextToken();
  						frameskip = (int)st.nval;
  					}
  					if(key.equals("colormute")) {
  						st.nextToken();
  						colormute = st.sval.equalsIgnoreCase("true");
  					}
  					if(key.equals("sgbborder")) {
  						st.nextToken();
  						sgbborder = st.sval.equalsIgnoreCase("true");
  					}
  					if(key.equals("debuglevel")) {
  						st.nextToken();
  						debuglevel = (int)st.nval;
  					}
  					if(key.equals("keys")) {
  						st.nextToken();
  						key_up = (int)st.nval;
  						st.nextToken();
  						key_down = (int)st.nval;
  						st.nextToken();
  						key_left = (int)st.nval;
  						st.nextToken();
  						key_right = (int)st.nval;
  						st.nextToken();
  						key_a = (int)st.nval;
  						st.nextToken();
  						key_b = (int)st.nval;
  						st.nextToken();
  						key_select = (int)st.nval;
  						st.nextToken();
  						key_start = (int)st.nval;
  					}
  					if(key.equals("lastnetaddress")) {
  						st.nextToken();
  						lastnetaddress = st.sval;
  					}
  					if(key.equals("netlistentimeout")) {
  						st.nextToken();
  						netlistentimeout = (int)st.nval;
  					}
  					if(key.equals("netport")) {
  						st.nextToken();
  						netport = (int)st.nval;
  					}
  					if(key.equals("lastnetaddress")) {
  						st.nextToken();
  						lastnetaddress = st.sval;
  					}
  					if(key.equals("systemtype")) {
  						st.nextToken();
  						desiredsystem = (int)st.nval;
  					}
  					if(key.equals("cpupriority")) {
  						st.nextToken();
  						priority = (int)st.nval;
  					}
  					if(key.equals("videooutput")) {
  						st.nextToken();
  						videooutput = (int)st.nval;
  					}
  					if(key.equals("autowait")) {
  						st.nextToken();
  						autowait = st.sval.equalsIgnoreCase("true");
  					}
  					// by retroK
  					if(key.equals("usesound")) {
  						 st.nextToken();
  						 usesound = st.sval.equals("true");
  					} 
  				}
  			}
  			
  			cr.close();
  		} catch(Exception e) {
  			System.err.println("error reading settings file:");
  			System.err.println(e.getClass());
  			System.err.println(e.getMessage());
  		}
  	}
  	
  	public static void save(Frame tosave) {
  		File cfgfile;
  		Writer cw;
  
  		winloc = tosave.getLocation();
  		
  		// yay! file stuff!
  		try {
  			cfgfile = new File("Pgb.cfg");
  			cw = new FileWriter(cfgfile);
  			
  			cw.write("# Pgb config file" + "\r\n");
  			cw.write("# Edit at your own risk" + "\r\n");
  			cw.write("\r\n");
  			cw.write("debuglevel " + debuglevel + "\r\n");
  			cw.write("frameskip " + frameskip + "\r\n");
  			cw.write("keys " + key_up + " " + key_down + " " + key_left + " " + key_right + " " + key_a + " " + key_b + " " + key_select + " " + key_start + "\r\n");
  