source: branches/juciphox/platform/ixus950_sd850/sub/100c/capt_seq.c @ 416

Revision 416, 9.7 KB checked in by Jucifer, 5 years ago (diff)

(pretty much from http://chdk.setepontos.com/index.php/topic,688.0.html:)

  • all uBASIC commands beginning with "get_" can now use the "new" syntax (e.g. [f=]get_focus, S=get_prop 205), the ones listed in Wikia work as they used to

+ applied PhyrePhox?'s customizations (the newest commands have the new syntax ([x=]command)), http://chdk.setepontos.com/index.php/topic,978.msg8339.html#msg8339

+ applied wontolla's RAW purge, http://chdk.setepontos.com/index.php/topic,557.msg5849.html#msg5849

+ applied m2tk's gui_fselect.c-patch, http://chdk.setepontos.com/index.php/topic,1059.msg9530.html#msg9530

+ applied CHDKLover's and msl's Symbol Mod, http://chdk.setepontos.com/index.php/topic,1133.msg10043.html#msg10043

+ applied Velo's Lua Scripting Integration (and added all new uBASIC-commands), http://chdk.setepontos.com/index.php/topic,1194.msg11413.html#msg11413

+ added scripting command get_exp_count (value incremented by 1 on every exposure, returns numbers as in the files saved by the camera (1-9999, should be taken into account when scripting, maybe something along these lines:
T=get_exp_count+N
if T>9999 then T=T-9999
press "shoot_half"
press "shoot_full"
do
until get_exp_count=T
release "shoot_full"
), ubasic syntax: [x=]get_exp_count ([]=optional))

+ added scripting command is_pressed. Usage is similar to is_key, but checks, if a button is pressed, when the command is called. This can be really useful in autostart-scripts.

+ added script command autostarted, returns 1/true if script was autostarted, 0/false if not

  • modified get_script_autostart and set_script_autostart to read & write conf.script_startup (values: 0=off, 1=on, 2=once)
  • new script autostart option(s): Off, On, Once
  • user menu modified
    • now with 14 entries (that's what fits on my screen with the default font)
    • main menu -entry removed
    • invoked also with shoot_half + menu
    • can be used as root menu, main menu becomes accessible with shoot_half + menu
  • faster menu navigation
    • in alt menus and file browser, shoot_half can be used with up/down to move 4 items up/down at a time
    • int-variable changing behaviour is modified: zoom rocker works also a bit like shift: when "held down" while pressing left/right, zoom_out changes values by 10, zoom_in by 100, shoot_half by 1000.
    • int-variables can be set to 0 with shoot_half+set
    • when changing enum-type-variables (e.g. Tv bracketing value), zoom_in(+left/right) changes value by 6 (2EV), zoom_out and(/or) shoot_half by 3 (1EV).

+ added numbers 2, 4 and 5 from cyril42e's modification list, http://chdk.setepontos.com/index.php/topic,1687.msg15345.html#msg15345

+ added scriptless Ricoh & home hacked remote support from SDM 1.70

+ added fbonomi's shot histogram, commands shot_histo_enable 0|1, get_histo_range from to, http://chdk.setepontos.com/index.php/topic,1145.msg13008.html#msg13008

+ added hiker_jon's edge overlay code for testing, may or may not work, http://chdk.setepontos.com/index.php/topic,1192.msg11317.html#msg11317

+ and last and perhaps least, added the missing get_raw_nr to tokenizer.c

I may have forgotten something. Hopefully nothing major, though.

Line 
1#include "lolevel.h"
2#include "platform.h"
3#include "core.h"
4
5#define RAWDATA_AVAILABLE (1)
6#define RAWDATA_SAVED (2)
7
8#define NR_ON (2)
9#define NR_OFF (1)
10
11static long raw_save_stage;
12
13void capt_seq_hook_raw_here()
14{
15    raw_save_stage = RAWDATA_AVAILABLE;
16    core_rawdata_available();
17    while (raw_save_stage != RAWDATA_SAVED){
18        _SleepTask(10);
19    }
20}
21
22void hook_raw_save_complete()
23{
24    raw_save_stage = RAWDATA_SAVED;
25}
26
27
28void capt_seq_hook_set_nr()
29{
30    long *nrflag = (long*)0xED44;
31
32    switch (core_get_noise_reduction_value()){
33    case NOISE_REDUCTION_AUTO_CANON:
34        // leave it alone
35        break;
36    case NOISE_REDUCTION_OFF:
37        *nrflag = NR_OFF;
38        break;
39    case NOISE_REDUCTION_ON:
40        *nrflag = NR_ON;
41        break;
42    };
43}
44
45
46void __attribute__((naked,noinline)) sub_FFB10B64_my(long p)
47{
48    asm volatile (
49"               STMFD   SP!, {R4,LR}\n"
50"               MOV     R4, R0\n"
51"               SUB     SP, SP, #0xC\n"
52"               BL      sub_FFB115D4\n"
53
54//"             MOVL    R1, 0xFFFFFFFF\n"       // asm doesn't like this. Thus:
55               "MVN     R1, #0\n"
56
57"               BL      sub_FFB21E2C\n" //ClearEventFlag
58"               MOV     R0, #0x8A\n"
59"               ADD     R1, SP, #4\n"
60"               MOV     R2, #4\n"
61"               BL      sub_FF81BC98\n"
62"               TST     R0, #1\n"
63"               BEQ     loc_FFB10BA4\n"
64
65"               MOV     R1, #0x1D0\n"
66// means: "     MOV     R1, #0x1D,28\n"
67
68"               LDR     R0, =0xFFB109E8\n" //"SsCaptureSeq.c"
69"               ADD     R1, R1, #2\n"
70"               BL      sub_FFB2F4F0\n" //DebugAssert
71"loc_FFB10BA4:\n"
72"               LDR     R3, =0xAAB80\n"
73"               LDR     R2, =0xAAC40\n"
74"               LDR     R0, [R3,#0x7C]\n"
75"               LDRSH   R1, [R2,#0xE]\n"
76"               BL      sub_FFA4226C\n"
77"               MOV     R0, R4\n"
78"               BL      sub_FFB1096C\n"
79            "BL      wait_until_remote_button_is_released\n"
80               "BL      capt_seq_hook_set_nr\n"  // + <- ADDED !!!!!
81"               LDR     R3, =0xED48\n"
82"               LDR     R0, [R3]\n"
83               "B       sub_FFB10BC8\n"  // ---> jump to the original code in ROM, see below
84//FFB10BC8      BL      sub_FFA42780
85    );
86}
87
88// orig. is sub_FFB0D80C
89void __attribute__((naked,noinline)) sub_FFB0D80C_my(long p)
90{
91    asm volatile (
92       
93"                STMFD   SP!, {R4,R5,LR}\n"
94"                LDR     R5, =0xAAB80\n"
95"                LDR     R4, [R0,#0xC]\n"
96"                LDR     R2, [R5,#0x24]\n"
97"                LDR     R3, [R4,#8]\n"
98"                CMP     R2, #0\n"
99"                ORR     R3, R3, #1\n"
100"                STR     R3, [R4,#8]\n"
101"                BNE     loc_FFB0D838\n"
102"                MOV     R0, #2\n"
103"                BL      sub_FFAF1CA4\n"
104"loc_FFB0D838:\n"
105"                BL      sub_FFB0E394\n" //Set_CMD25Write_62
106"                LDR     R3, [R5,#0x24]\n"
107"                CMP     R3, #0\n"
108"                BNE     loc_FFB0D8A4\n"
109"                MOV     R0, R4\n"
110"                BL      sub_FFB0F59C\n"
111"                TST     R0, #1\n"
112"                BEQ     loc_FFB0D868\n"
113"                MOV     R2, R4\n"
114"                MOV     R1, #1\n"
115"                LDMFD   SP!, {R4,R5,LR}\n"
116"                B       sub_FFB0BF7C\n"
117"loc_FFB0D868:\n"
118"                BL      sub_FF826284\n"
119"                BL      sub_FF81BE94\n"
120"                LDRH    R2, [R5]\n"
121//"                MOVL    R3, 0x420F\n"        // asm doesn't understand this. Thus:
122                "MOV    R3, #0x4200\n"
123// means:       "MOV    R3, #0x42,24\n"
124                "ADD    R3, R3, #0xF\n"
125
126"                CMP     R2, R3\n"
127"                STR     R0, [R4,#0x14]\n"
128"                BNE     loc_FFB0D88C\n"
129"                BL      sub_FFAF185C\n"
130"loc_FFB0D88C:\n"
131"                MOV     R0, R4\n"
132"                BL      sub_FFB10A4C\n"
133"                BL      sub_FFB11440\n"
134"                MOV     R0, R4\n"
135//"                BL      sub_FFB10B64\n"
136                "BL      sub_FFB10B64_my\n"  //---------> ESCAPE to My !!!!!
137                "BL      capt_seq_hook_raw_here\n"  // + <- ADDED !!!!!
138"                B       loc_FFB0D8B8\n"
139"loc_FFB0D8A4:\n"
140"                LDR     R3, =0xED30\n"
141"                LDR     R2, [R3]\n"
142"                CMP     R2, #0\n"
143"                MOVNE   R0, #0x1D\n"
144"                MOVEQ   R0, #0\n"
145"loc_FFB0D8B8:\n"
146"                MOV     R1, #1\n"
147"                MOV     R2, R4\n"
148"                BL      sub_FFB0BF7C\n"
149"                BL      sub_FFB10EE0\n"
150"                CMP     R0, #0\n"
151"                LDRNE   R3, [R4,#8]\n"
152"                ORRNE   R3, R3, #0x2000\n"
153"                STRNE   R3, [R4,#8]\n"
154"                LDMFD   SP!, {R4,R5,PC}\n"
155    );
156}
157
158// orig. at FFB0DD10
159void __attribute__((naked,noinline)) capt_seq_task()
160{
161        asm volatile (
162"                STMFD   SP!, {R4,LR}\n"
163"                SUB     SP, SP, #4\n"
164"                MOV     R4, SP\n"
165"                B       loc_FFB0DEB4\n"
166"loc_FFB0DD20:\n"
167"                LDR     R2, [SP]\n"
168"                LDR     R3, [R2]\n"
169"                MOV     R0, R2\n"
170"                CMP     R3, #0x17\n"
171"                LDRLS   PC, [PC,R3,LSL#2]\n"
172"                B       loc_FFB0DE88\n"
173"                .long loc_FFB0DD98\n"
174"                .long loc_FFB0DDB8\n"
175"                .long loc_FFB0DDCC\n"
176"                .long loc_FFB0DDE0\n"
177"                .long loc_FFB0DDD8\n"
178"                .long loc_FFB0DDE8\n"
179"                .long loc_FFB0DDF0\n"
180"                .long loc_FFB0DDFC\n"
181"                .long loc_FFB0DE04\n"
182"                .long loc_FFB0DE10\n"
183"                .long loc_FFB0DE18\n"
184"                .long loc_FFB0DE20\n"
185"                .long loc_FFB0DE28\n"
186"                .long loc_FFB0DE30\n"
187"                .long loc_FFB0DE38\n"
188"                .long loc_FFB0DE40\n"
189"                .long loc_FFB0DE48\n"
190"                .long loc_FFB0DE54\n"
191"                .long loc_FFB0DE5C\n"
192"                .long loc_FFB0DE64\n"
193"                .long loc_FFB0DE6C\n"
194"                .long loc_FFB0DE78\n"
195"                .long loc_FFB0DE80\n"
196"                .long loc_FFB0DE9C\n"
197"loc_FFB0DD98:\n"
198"                BL      sub_FFB0E3BC\n"
199                "BL      shooting_expo_param_override\n"   // + <- ADDED !!!!!
200"                BL      sub_FFB0BA04\n"
201"                LDR     R3, =0xAAB80\n"
202"                LDR     R2, [R3,#0x24]\n"
203"                CMP     R2, #0\n"
204"                BEQ     loc_FFB0DE98\n"
205"                BL      sub_FFB0D8E4\n"
206"                B       loc_FFB0DE98\n"
207"loc_FFB0DDB8:\n"
208//"                BL      sub_FFB0D80C\n"
209"                BL      sub_FFB0D80C_my\n"  //---------> ESCAPE to My !!!!!
210"loc_FFB0DDBC:\n"
211"                LDR     R2, =0xAAB80\n"
212"                MOV     R3, #0\n"
213"                STR     R3, [R2,#0x24]\n"
214"                B       loc_FFB0DE98\n"
215"loc_FFB0DDCC:\n"
216"                MOV     R0, #1\n"
217"                BL      sub_FFB0E5E8\n"
218"                B       loc_FFB0DE98\n"
219"loc_FFB0DDD8:\n"
220"                BL      sub_FFB0DFA0\n"
221"                B       loc_FFB0DDBC\n"
222"loc_FFB0DDE0:\n"
223"                BL      sub_FFB0E374\n" //BackLightDrv_LcdBackLightOff_16
224"                B       loc_FFB0DDBC\n"
225"loc_FFB0DDE8:\n"
226"                BL      sub_FFB0E384\n"
227"                B       loc_FFB0DE98\n"
228"loc_FFB0DDF0:\n"
229"                BL      sub_FFB0E4D8\n"
230"                BL      sub_FFB0BA04\n"
231"                B       loc_FFB0DE98\n"
232"loc_FFB0DDFC:\n"
233"                BL      sub_FFB0D9BC\n"
234"                B       loc_FFB0DE98\n"
235"loc_FFB0DE04:\n"
236"                BL      sub_FFB0E54C\n"
237"                BL      sub_FFB0BA04\n"
238"                B       loc_FFB0DE98\n"
239"loc_FFB0DE10:\n"
240"                BL      sub_FFB0E374\n" //BackLightDrv_LcdBackLightOff_16
241"                B       loc_FFB0DE98\n"
242"loc_FFB0DE18:\n"
243"                BL      sub_FFB0FCD0\n"
244"                B       loc_FFB0DE98\n"
245"loc_FFB0DE20:\n"
246"                BL      sub_FFB0FEA4\n"
247"                B       loc_FFB0DE98\n"
248"loc_FFB0DE28:\n"
249"                BL      sub_FFB0FF38\n"
250"                B       loc_FFB0DE98\n"
251"loc_FFB0DE30:\n"
252"                BL      sub_FFB10034\n"
253"                B       loc_FFB0DE98\n"
254"loc_FFB0DE38:\n"
255"                BL      sub_FFB102BC\n"
256"                B       loc_FFB0DE98\n"
257"loc_FFB0DE40:\n"
258"                BL      sub_FFB1030C\n"
259"                B       loc_FFB0DE98\n"
260"loc_FFB0DE48:\n"
261"                MOV     R0, #0\n"
262"                BL      sub_FFB10360\n"
263"                B       loc_FFB0DE98\n"
264"loc_FFB0DE54:\n"
265"                BL      sub_FFB10534\n"
266"                B       loc_FFB0DE98\n"
267"loc_FFB0DE5C:\n"
268"                BL      sub_FFB105D0\n"
269"                B       loc_FFB0DE98\n"
270"loc_FFB0DE64:\n"
271"                BL      sub_FFB1069C\n"
272"                B       loc_FFB0DE98\n"
273"loc_FFB0DE6C:\n"
274"                BL      sub_FFB0E73C\n"
275"                BL      sub_FFB0D730\n"
276"                B       loc_FFB0DE98\n"
277"loc_FFB0DE78:\n"
278"                BL      sub_FFB10174\n"
279"                B       loc_FFB0DE98\n"
280"loc_FFB0DE80:\n"
281"                BL      sub_FFB101D0\n"
282"                B       loc_FFB0DE98\n"
283"loc_FFB0DE88:\n"
284"                MOV     R1, #0x4F0\n"
285"                LDR     R0, =0xFFB0D58C\n" //=aSsshoottask_c
286"                ADD     R1, R1, #1\n"
287"                BL      sub_FFB2F4F0\n" //DebugAssert
288"loc_FFB0DE98:\n"
289"                LDR     R2, [SP]\n"
290"loc_FFB0DE9C:\n"
291"                LDR     R3, =0x84428\n"
292"                LDR     R1, [R2,#4]\n"
293"                LDR     R0, [R3]\n"
294"                BL      sub_FFB21C90\n" //SetEventFlag
295"                LDR     R0, [SP]\n"
296"                BL      sub_FFB0D60C\n"
297"loc_FFB0DEB4:\n"
298"                LDR     R3, =0x8442C\n"
299"                MOV     R1, R4\n"
300"                LDR     R0, [R3]\n"
301"                MOV     R2, #0\n"
302"                BL      sub_FFB223A8\n" //ReceiveMessageQueue
303"                TST     R0, #1\n"
304"                BEQ     loc_FFB0DD20\n"
305"                MOV     R1, #0x410\n"
306"                LDR     R0, =0xFFB0D58C\n" //=aSsshoottask_c
307"                ADD     R1, R1, #5\n"
308"                BL      sub_FFB2F4F0\n" //DebugAssert
309"                BL      sub_FFB2396C\n"
310"                ADD     SP, SP, #4\n"
311"                LDMFD   SP!, {R4,PC}\n"
312        );
313}
314
Note: See TracBrowser for help on using the repository browser.