orgRom.loadRom(); path.setText(orgRom.getPath());
if (orgRom.loadRom()) path.setText(orgRom.getPath()); else orgRom = tmpRom;
    public void actionPerformed(ActionEvent ae)    {        if (ae.getActionCommand().equals("load"))        {            //don't overwrite orginal ROM file            if (orgRom == JHack.main.getOrginalRomFile(rom.getRomType()))            {                orgRom = new Rom();            }            orgRom.loadRom();            path.setText(orgRom.getPath());        }        else if (ae.getActionCommand().equals("reset"))        {            if (!orgRom.isLoaded)            {                JOptionPane.showMessageDialog(null,                    "Load an orginal ROM first!", "Load a ROM!",                    JOptionPane.ERROR_MESSAGE);            }            else            {                getSelectedRange().resetArea();            }        }        else if (ae.getActionCommand().equals("makeips"))        {            if (!orgRom.isLoaded)            {                JOptionPane.showMessageDialog(null,                    "Load an orginal ROM first!", "Load a ROM!",                    JOptionPane.ERROR_MESSAGE);            }            else            {                getSelectedRange().makeIPS();            }        }        else if (ae.getActionCommand().equals("decomp"))        {            ResetRange rr = this.getSelectedRange();            byte[] buffer = new byte[1024 * 1024];            int[] tmp = decomp(rr.getStart(), buffer, buffer.length);            if (tmp[0] < 0)                JOptionPane.showMessageDialog(this.mainWindow, "Error #"                    + tmp[0] + " decompressing data. Data may be invalid\n"                    + "or buffer may be too small.", "Error: Unable to decomp",                    JOptionPane.ERROR_MESSAGE);            else            {                JOptionPane.showMessageDialog(this.mainWindow, "Decompressed "                    + tmp[0] + " bytes.\n" + "Select an output file.",                    "Decomp successful", JOptionPane.INFORMATION_MESSAGE);                try                {                    FileOutputStream out = new FileOutputStream(getFile(true,                        "smc", "Decompressed Graphics Dump"));                    out.write(buffer, 0, Math.max(tmp[0], 8192));                    out.close();                }                catch (NullPointerException e)                {                    //User canceled                }                catch (FileNotFoundException e)                {                    System.out                        .println("File not found for saving graphics dump... this can't happen!");                    e.printStackTrace();                }                catch (IOException e)                {                    e.printStackTrace();                    JOptionPane.showMessageDialog(this.mainWindow,                        "File system error while saving data.",                        "Error: Unable to save", JOptionPane.ERROR_MESSAGE);                }            }        }        else if (ae.getActionCommand().equals("comp"))        {            try            {                File f = getFile(false, "smc", "Decompressed Graphics Dump");                FileInputStream in = new FileInputStream(f);                byte[] udata = new byte[(int) f.length()], buffer = new byte[(int) f                    .length()];                in.read(udata);                in.close();                int tmp = comp(udata, buffer, getArrSize(udata));                if (tmp > this.getSelectedRange().getLen())                {                    //longer than selected area                    if (JOptionPane.showConfirmDialog(this.mainWindow,                        "Compressed data is larger than the selected range.\n"                            + "Do you wish to write past selected range?",                        "Overwrite?", JOptionPane.WARNING_MESSAGE,                        JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION)                        return;                }                rom.write(this.getSelectedRange().getStart(), buffer, tmp);                JOptionPane.showMessageDialog(this.mainWindow, "Compressed to "                    + tmp + " bytes.", "Comp successful",                    JOptionPane.INFORMATION_MESSAGE);            }            catch (NullPointerException e)            {                //User canceled            }            catch (FileNotFoundException e)            {                System.out                    .println("File not found for reading graphics dump... this can't happen!");                e.printStackTrace();            }            catch (IOException e)            {                e.printStackTrace();                JOptionPane.showMessageDialog(this.mainWindow,                    "File system error while reading data.",                    "Error: Unable to read file", JOptionPane.ERROR_MESSAGE);            }        }        else if (ae.getActionCommand().equals("close"))        {            hide();        }    }