This is how the code looks now, and led works at where it is too. I also uncommented all hooks i think u cal them, except cap_seq and exp_drv, cam works in lock mode and can take pictures and use like normal.
void __attribute__((naked,noinline)) task_Startup_my() {
// sub_FF81FBF4
asm volatile (
"STMFD SP!, {R4, LR} \n"
"BL sub_FF816588 \n"
"BL sub_FF83543C \n"
"BL sub_FF83364C \n"
"BL sub_FF83C018 \n"
"BL sub_FF83C204 \n"
//"BL sub_FF83C0AC \n" // skip starting diskboot.bin again
"BL sub_FF83C3A4 \n"
"BL sub_FF832208 \n"
"BL sub_FF83C234 \n"
"BL sub_FF839944 \n"
"BL sub_FF83C3A8 \n"
"BL CreateTask_spytask \n" // added
"BL sub_FF834190 \n"
"BL taskcreatePhySw_my \n" // patched
"BL sub_FF837B48 \n"
"BL sub_FF83C3C0 \n"
"BL sub_FF831600 \n"
"BL sub_FF832FB0 \n"
"BL sub_FF83BD8C \n"
"BL sub_FF8335EC \n"
"BL sub_FF832F4C \n"
"BL sub_FF83223C \n"
"BL sub_FF83CE60 \n"
"BL sub_FF832F10 \n"
"LDMFD SP!, {R4, LR} \n"
//"B loc_FF8166A8 \n"
"B sub_FF8166A8 \n" // continue in firmware
);
}
void __attribute__((naked,noinline)) taskcreatePhySw_my() {
// sub_FF834248
asm volatile (
"STMFD SP!,{R3-R5,LR} \n"
"LDR R4, =0x1C30 \n"
"LDR R0, [R4, #4] \n"
"CMP R0, #0 \n"
"BNE sub_FF8341C4 \n" // so we can jump right back in to firmware later
"MOV R3, #0 \n"
"STR R3, [SP] \n"
"LDR R3, =task_PhySw \n" // FF83415C
"MOV R2, #0x2000 \n" // stack size for new task_PhySw so we don't have to do stack switch
"B sub_FF83426C \n" // added, continue in firmware
);
}
void spytask(long ua, long ub, long uc, long ud, long ue, long uf) {
core_spytask();
}
void CreateTask_spytask() {
_CreateTask("SpyTask", 0x19, 0x2000, core_spytask, 0);
}
void __attribute__((naked,noinline)) init_file_modules_task() {
*((volatile int *) LED_AF) = 0x46;
// sub_FF8933BC
asm volatile (
"STMFD SP!, {R4-R6,LR} \n"
"BL sub_FF88D7E8 \n"
"LDR R5, =0x5006 \n"
"MOVS R4, R0 \n"
"MOVNE R1, #0 \n"
"MOVNE R0, R5 \n"
"BLNE sub_FF89167C \n"
"BL sub_FF88D814 \n"
"BL core_spytask_can_start \n" // added, CHDK: Set "it's-safe-to-start"-Flag for spytask
"B sub_FF895864 \n" // added, continue in firmware
);
}