Skip to content

Commit

Permalink
Added findImage
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderOMara committed Jan 20, 2025
1 parent 5dec7ad commit bf9ae8e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion macho/universal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { FatHeader } from '../mach/fatheader.ts';
import { MachHeader } from '../mach/machheader.ts';
import type { Reader } from '../util/reader.ts';
import { Architecture } from './architecture.ts';
import type { MachO } from './macho.ts';
import { MachO } from './macho.ts';

/**
* Maximum power of 2 alignment amount.
Expand Down Expand Up @@ -396,6 +396,19 @@ export class Universal {
throw new RangeError('Architecture not found');
}

/**
* Find Mach-O image for architecture.
*
* @param target Architecture.
* @returns Mach-O image.
*/
private async findImage(target: Const<Architecture>): Promise<MachO> {
const arch = this.findArch(target);
const macho = new MachO();
await macho.open(this.mReader!, this.mBase + arch.offset, arch.size);
return this.make(macho);
}

/**
* Validate type of Mach-O.
*
Expand Down

0 comments on commit bf9ae8e

Please sign in to comment.