Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/hexview #427

Merged
merged 49 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
3c6aca3
angr decomp draft tests not tested
Feb 5, 2024
4e425f7
tests pass, need better assertion
Feb 5, 2024
ac7213d
Add new tag for angr decompilation for auto analysis
Feb 8, 2024
61ce702
frontend for decompilation along with view tabs
Feb 8, 2024
aa3bea3
lint
Feb 8, 2024
faf2ca3
changelog
Feb 8, 2024
613bc75
add hr to make it look more like tabs
Feb 8, 2024
5be8c53
forgot angr linting
Feb 8, 2024
e079f46
lint again
Feb 8, 2024
9f0deac
some things i missed
Feb 8, 2024
e3a05fd
remove an errouneous ipdb and hide horizontal scroll behind toolbar i…
Feb 9, 2024
4de83ce
refactoring hex view so i can scroll
Feb 9, 2024
314b6c4
good ol double scroll
Feb 9, 2024
ab11f42
small changes
Feb 9, 2024
f6ba17f
wheel works with hex view
Feb 9, 2024
19d1843
almsot working, bottom of rect wrong
Feb 9, 2024
6a41bd1
lint
Feb 9, 2024
7172203
Refactor hex view, remove resize on hex view
Feb 14, 2024
836f8ab
lint
Feb 14, 2024
354eeca
Merge remote-tracking branch 'origin' into feature/angr-decompilation
Feb 14, 2024
52d4bbf
some review changes
Feb 15, 2024
cb0d752
Support thumb in decompilation view
Feb 15, 2024
9bfde79
make tab view
Feb 15, 2024
3e24c7a
lint
Feb 15, 2024
cf8302b
fix resize
Feb 15, 2024
5f5a575
CSS magic
Feb 15, 2024
fe3a007
lint
Feb 15, 2024
4fc7ba9
Scrolling all working now, and moved resourceNodeMap to a store
Feb 16, 2024
be31171
im going insane
Feb 16, 2024
642819f
Changelog
Feb 21, 2024
c81c1c6
Remove decomp changes :p
Feb 21, 2024
6de574e
remove the decomp python changes
Feb 21, 2024
48afb2e
Merge branch 'redballoonsecurity:master' into refactor/hexview
dannyp303 Feb 22, 2024
f8672e8
Update stores.js
dannyp303 Feb 23, 2024
e7e11ec
Jacobs css/formatting review
Feb 23, 2024
7634d76
Merge branch 'refactor/hexview' of github.com:dannyp303/ofrak into re…
Feb 23, 2024
214ae4b
Update frontend/src/hex/HexView.svelte
dannyp303 Feb 23, 2024
be31938
Update frontend/src/hex/HexView.svelte
dannyp303 Feb 23, 2024
da771d6
addressing review
Feb 23, 2024
debcd81
Merge branch 'refactor/hexview' of github.com:dannyp303/ofrak into re…
Feb 23, 2024
3ef1c41
lint
Feb 23, 2024
bfe8930
Update frontend/src/utils/SearchBar.svelte
dannyp303 Feb 26, 2024
c204609
Update frontend/src/views/ComponentsView.svelte
dannyp303 Feb 26, 2024
0d493d9
Update frontend/src/hex/HexView.svelte
dannyp303 Feb 26, 2024
39221d3
more review changes
Feb 27, 2024
3c8bfba
Merge branch 'refactor/hexview' of github.com:dannyp303/ofrak into re…
Feb 27, 2024
dc1b62b
more review changes
Feb 27, 2024
e6d8edf
remove extra overflow css element for resource tree
Feb 27, 2024
e7c380c
missed one
Feb 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
32 changes: 2 additions & 30 deletions frontend/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,9 @@
import AssemblyView from "./views/AssemblyView.svelte";
import AttributesView from "./views/AttributesView.svelte";
import AudioPlayer from "./utils/AudioPlayer.svelte";
import ByteclassView from "./views/ByteclassView.svelte";
import CarouselSelector from "./utils/CarouselSelector.svelte";
import EntropyView from "./views/EntropyView.svelte";
import Gamepad from "./utils/Gamepad.svelte";
import HexView from "./views/HexView.svelte";
import JumpToOffset from "./utils/JumpToOffset.svelte";
import HexView from "./hex/HexView.svelte";
import LoadingAnimation from "./utils/LoadingAnimation.svelte";
import MagnitudeView from "./views/MagnitudeView.svelte";
import Pane from "./utils/Pane.svelte";
import ResourceTreeView from "./resource/ResourceTreeView.svelte";
import Split from "./utils/Split.svelte";
Expand Down Expand Up @@ -206,11 +201,7 @@ Answer by running riddle.answer('your answer here') from the console.`);
{/if}
</Pane>
</Split>
<Pane
slot="second"
scrollY="{hexScrollY}"
displayMinimap="{currentResource && !useAssemblyView && !useTextView}"
>
<Pane slot="second" scrollY="{hexScrollY}">
{#if useAssemblyView}
<AssemblyView />
{:else if useTextView}
Expand All @@ -227,25 +218,6 @@ Answer by running riddle.answer('your answer here') from the console.`);
Named slot must be outside {#if} because of:
https://github.com/sveltejs/svelte/issues/5604
-->
<svelte:fragment slot="minimap">
<JumpToOffset
dataLenPromise="{dataLenPromise}"
scrollY="{hexScrollY}"
/>
{#if carouselSelection === "Entropy"}
<EntropyView scrollY="{hexScrollY}" />
{:else if carouselSelection === "Byteclass"}
<ByteclassView scrollY="{hexScrollY}" />
{:else if carouselSelection === "Magnitude"}
<MagnitudeView scrollY="{hexScrollY}" />
{/if}
<div class="carousel">
<CarouselSelector
options="{['Magnitude', 'Entropy', 'Byteclass']}"
bind:selectedString="{carouselSelection}"
/>
</div>
</svelte:fragment>
</Pane>
</Split>
{/await}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@
import LoadingTextVertical from "../utils/LoadingTextVertical.svelte";

import { hexToByteArray } from "../helpers.js";
import { screenHeight } from "./stores.js";
import { selectedResource, settings } from "../stores.js";

import { onMount } from "svelte";

export let scrollY;
export let dataLength, currentPosition;
let data = undefined;

$: colorArray = [
Expand Down Expand Up @@ -124,17 +125,13 @@

context.strokeStyle = "red";
context.lineWidth = Math.ceil(canvas.height / 512);
if (
data !== undefined &&
data.length > alignment * 3 &&
$scrollY.viewHeight !== 1
) {
if (data !== undefined && data.length > alignment * 3) {
// Offset Y by 0.5 because of: https://stackoverflow.com/a/48970774
context.strokeRect(
0,
Math.ceil($scrollY.top * canvas.height) - 0.5,
Math.ceil((currentPosition / dataLength) * canvas.height) - 0.5,
alignment,
Math.ceil(($scrollY.viewHeight * canvas.height) / 2)
Math.ceil(($screenHeight / dataLength) * canvas.height)
);
}
}
Expand All @@ -144,11 +141,11 @@
<canvas
bind:this="{canvas}"
on:mousedown="{(e) => {
if ($scrollY.viewHeight < 1) {
$scrollY.top = e.offsetY / canvas.offsetHeight;
$scrollY.top = Math.max(Math.min($scrollY.top, 1), 0);
clicking = true;
}
currentPosition =
Math.floor(
Math.floor(dataLength * (e.offsetY / canvas.offsetHeight)) / alignment
) * alignment;
clicking = true;
}}"
on:mouseup="{(e) => {
clicking = false;
Expand All @@ -157,15 +154,13 @@
clicking = false;
}}"
on:mousemove="{(e) => {
if (clicking && $scrollY.viewHeight < 1) {
$scrollY.top = e.offsetY / canvas.offsetHeight;
$scrollY.top = Math.max(Math.min($scrollY.top, 1), 0);
}
}}"
on:wheel="{(e) => {
if ($scrollY.viewHeight < 1) {
$scrollY.top += e.deltaY * 0.0001;
$scrollY.top = Math.max(Math.min($scrollY.top, 1), 0);
if (clicking) {
currentPosition =
Math.floor(
Math.floor(dataLength * (e.offsetY / canvas.offsetHeight)) /
alignment
) * alignment;
clicking = true;
}
}}"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
<script>
import LoadingTextVertical from "../utils/LoadingTextVertical.svelte";

import { screenHeight } from "./stores.js";
import { hexToByteArray } from "../helpers.js";
import { selectedResource, settings } from "../stores.js";

import { onMount } from "svelte";

export let scrollY;
export let dataLength, currentPosition;
let data = undefined;

$: bgcolors = hexToByteArray($settings.background.slice(1));
Expand Down Expand Up @@ -105,17 +105,13 @@

context.strokeStyle = "red";
context.lineWidth = Math.ceil(canvas.height / 512);
if (
data !== undefined &&
data.length > alignment * 3 &&
$scrollY.viewHeight !== 1
) {
if (data !== undefined && data.length > alignment * 3) {
// Offset Y by 0.5 because of: https://stackoverflow.com/a/48970774
context.strokeRect(
0,
Math.ceil($scrollY.top * canvas.height) - 0.5,
Math.ceil((currentPosition / dataLength) * canvas.height) - 0.5,
alignment,
Math.ceil(($scrollY.viewHeight * canvas.height) / 2)
Math.ceil(($screenHeight / dataLength) * canvas.height)
);
}

Expand All @@ -130,11 +126,11 @@
<canvas
bind:this="{canvas}"
on:mousedown="{(e) => {
if ($scrollY.viewHeight < 1) {
$scrollY.top = e.offsetY / canvas.offsetHeight;
$scrollY.top = Math.max(Math.min($scrollY.top, 1), 0);
clicking = true;
}
currentPosition =
Math.floor(
Math.floor(dataLength * (e.offsetY / canvas.offsetHeight)) / 16
) * 16;
clicking = true;
}}"
on:mouseup="{(e) => {
clicking = false;
Expand All @@ -143,15 +139,12 @@
clicking = false;
}}"
on:mousemove="{(e) => {
if (clicking && $scrollY.viewHeight < 1) {
$scrollY.top = e.offsetY / canvas.offsetHeight;
$scrollY.top = Math.max(Math.min($scrollY.top, 1), 0);
}
}}"
on:wheel="{(e) => {
if ($scrollY.viewHeight < 1) {
$scrollY.top += e.deltaY * 0.0001;
$scrollY.top = Math.max(Math.min($scrollY.top, 1), 0);
if (clicking) {
currentPosition =
Math.floor(
Math.floor(dataLength * (e.offsetY / canvas.offsetHeight)) / 16
) * 16;
clicking = true;
}
}}"
>
Expand Down
Loading
Loading