# Exe Patching Problem

**URL:** https://discourse.processing.org/t/exe-patching-problem/5909
**Category:** Coding Questions
**Created:** [November 25, 2018, 5:55am UTC](https://discourse.processing.org/t/exe-patching-problem/5909 "2018-11-25T05:55:17Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Odermonicon](https://avatars.discourse-cdn.com/v4/letter/o/96bed5/32.png) [@Odermonicon](https://discourse.processing.org/u/Odermonicon)
#### Post date: [November 25, 2018, 5:55am UTC](https://discourse.processing.org/t/exe-patching-problem/5909/1 "2018-11-25T05:55:17Z")

</div>

I get so many errors for no reason…  
(Reason: i did not initilaze a custom class 🤦‍♂️)

> **Code**
>
> Main:
> 
> ```auto
> byte[] bExe;
> String[] midpatch;
> Patch finpatch;
> 
> void setup() {
> selectOutput("Save the output file:", "fileOut");
> selectInput("Select the file:", "fileSel");
> selectInput("Select the patch:", "patchSel");
> }
> 
> void patchSel(File inpatch) {
> midpatch = loadStrings(inpatch);
> finpatch.convert(midpatch);
> }
> 
> void fileSel(File exe) {
> bExe = loadBytes(exe);
> }
> 
> void fileOut(File out) {
> println(out.getName());
> //finpatch.apply(bExe, /*out.isDirectory()+*/out.getName());
> }
> 
> ```
> 
> Patch:
> 
> ```auto
> class Patch {
> int[] adr;
> byte[] num;
> int len;
> void convert(String[] midpatch) {
> //String[] temp = new String[2];
> //println("Length of patch: " + midpatch.length);
> //adr = new int[midpatch.length];
> //num = new byte[midpatch.length];
> //len = midpatch.length;
> //for (int i=0;i<len;i++) {
> // temp = split(midpatch[i],":");
> // adr[i] = int(temp[0]);
> // num[i] = byte(int(temp[1]));
> //}
> }
> void apply(byte[] byt, String name) {
> byte[] bt = byt;
> for (int i=0;i<len;i++) {
> bt[adr[i]]=num[i];
> } saveBytes(name, bt);
> printArray(bt);
> }
> }
> 
> ```
