- Build a sphere tracer with WebGPU (paper, paper2, youtube)
- Create model with sdf functions from here
- Add light and shadows
- ???
- PROFIT
This code tested in Chrome and Firefox, should work on PC too. Press star and subscribe.
| import idc | |
| import idautils | |
| import idaapi | |
| FUNCTIONS_REGISTERS = {"g_log": "rcx", "g_log_error": "rdx"} | |
| def get_string_for_function(call_func_addr, register): | |
| """ | |
| :param start_addr: The function call address |
| import FreeCAD | |
| f1=open("surface.dat") | |
| coords=[] | |
| miny=1 | |
| for line in f1.readlines(): | |
| sline=line.strip() | |
| if sline and not sline.startswith('#'): | |
| ycoord=len(coords) | |
| lcoords=[] | |
| for xcoord, num in enumerate(sline.split()): |
My current target uses a deterministic pattern when calling C++ constructors, so I can use the CFG to identify object instantiation. Here are my notes about how to use Ghidra's decompiler to get the sizes of objects to be created:
We can use the parameter of operator_new() to find the size of the objects. Instead of parsing the instructions of the relevant basic blocks (and hoping that we don't run into some unexpected instruction sequences generated by the compiler) we can use the decompiler to get the association between the call to operator_new() and its parameter.
Ghidra/Features/Decompiler/ghidra_scripts/ShowCCallsScript.java contains a nice example of how to use the Decompiler API. First, an instance of DecompInterface must be created, as shown in setUpDecompiler(). Note that this method doesn't call openProgram() on the returned DecomInterface object, that is necessary to run decompilation! The decompileFunction() method works as expected - the returned DecompileResults object con
| #include "IMWidget.h" | |
| #include <QAction> | |
| #include <QApplication> | |
| #include <QClipboard> | |
| #include <QComboBox> | |
| #include <QImage> | |
| #include <QItemDelegate> | |
| #include <QListWidget> | |
| #include <QPainter> |
| use tokio::prelude::*; | |
| use tokio::runtime::TaskExecutor; | |
| use tokio::runtime::Runtime; | |
| use tokio::prelude::task::Task; | |
| use std::sync::{Arc, Mutex}; | |
| use std::thread; | |
| use std::time; | |
| /// A future-creating function | |
| fn custom_delay(seconds: f32) -> impl Future<Item=(), Error=()> { |
| #![allow(unused)] | |
| fn main() { | |
| use std::collections::HashMap; | |
| let mut a = HashMap::new(); | |
| a.insert(1, "a"); | |
| a.insert(2, "b"); | |
| println!("address a: {:p}", a[&1]); |
| use std::collections::HashMap; | |
| // Mutating one map | |
| fn merge1(map1: &mut HashMap<(), ()>, map2: HashMap<(), ()>) { | |
| map1.extend(map2); | |
| } | |
| // Without mutation | |
| fn merge2(map1: HashMap<(), ()>, map2: HashMap<(), ()>) -> HashMap<(), ()> { | |
| map1.into_iter().chain(map2).collect() |
| use std::collections::HashMap; | |
| use std::sync::mpsc; | |
| use std::sync::Arc; | |
| use std::sync::Mutex; | |
| use std::thread; | |
| fn main() { | |
| let (tx, rx) = mpsc::channel(); | |
| thread::spawn(move || { |
| use tokio::prelude::*; | |
| use tokio::runtime::TaskExecutor; | |
| use tokio::runtime::Runtime; | |
| use tokio::prelude::task::Task; | |
| use std::sync::{Arc, Mutex}; | |
| use std::thread; | |
| use std::time; | |
| /// A future-creating function | |
| fn custom_delay(seconds: f32) -> impl Future<Item=(), Error=()> { |