Index: /trunk/include/math.h
===================================================================
--- /trunk/include/math.h	(revision 511)
+++ /trunk/include/math.h	(revision 511)
@@ -0,0 +1,23 @@
+#ifndef MATH_H
+#define MATH_H
+
+#ifndef __VFP_FP__
+extern double d2d(double value);
+#else
+#define d2d(v) (v)
+#endif
+/*
+extern float logf(float v);
+extern float sqrtf(float v);
+extern float powf(float x, float y);
+extern float fabsf(float x);
+extern float scalbnf(float x, int n);
+extern float copysignf(float x, float y);
+*/
+extern double log(double x);
+extern double log2(double x);
+extern double log10(double x);
+extern double pow(double x, double y);
+extern double sqrt(double x);
+
+#endif
Index: /trunk/include/shot_histogram.h
===================================================================
--- /trunk/include/shot_histogram.h	(revision 511)
+++ /trunk/include/shot_histogram.h	(revision 511)
@@ -0,0 +1,14 @@
+#ifndef SHOT_HISTOGRAM_H
+#define SHOT_HISTOGRAM_H
+
+extern unsigned short shot_histogram[1024];
+extern unsigned short shot_margin_left, shot_margin_top, shot_margin_right, shot_margin_bottom;
+
+void build_shot_histogram();
+
+int shot_histogram_get_range(int histo_from, int histo_to);
+
+#define SHOT_HISTOGRAM_STEP 31
+#define SHOT_HISTOGRAM_MARGIN 100
+
+#endif
Index: /trunk/include/histogram.h
===================================================================
--- /trunk/include/histogram.h	(revision 511)
+++ /trunk/include/histogram.h	(revision 511)
@@ -0,0 +1,35 @@
+#ifndef HISTOGRAM_H
+#define HISTOGRAM_H
+
+#define HISTO_WIDTH                 128
+#define HISTO_HEIGHT                50
+
+#define HISTO_MODE_LINEAR           0
+#define HISTO_MODE_LOG              1
+
+#define HISTO_R                     0
+#define HISTO_G                     1
+#define HISTO_B                     2
+#define HISTO_RGB                   3
+#define HISTO_Y                     4
+
+#define ZEBRA_MODE_BLINKED_1        0
+#define ZEBRA_MODE_BLINKED_2        1
+#define ZEBRA_MODE_BLINKED_3        2
+#define ZEBRA_MODE_SOLID            3
+#define ZEBRA_MODE_ZEBRA_1          4
+#define ZEBRA_MODE_ZEBRA_2          5
+
+void histogram_process();
+void histogram_stop();
+void histogram_restart();
+extern void histogram_set_mode(unsigned int mode);
+extern void histogram_set_main(unsigned int main);
+
+extern unsigned char histogram[5][HISTO_WIDTH];
+extern long exposition_thresh;
+extern long under_exposed;
+extern long over_exposed;
+extern long histo_magnification;
+
+#endif
Index: /trunk/include/locale.h
===================================================================
--- /trunk/include/locale.h	(revision 511)
+++ /trunk/include/locale.h	(revision 511)
@@ -0,0 +1,1 @@
+
Index: /trunk/include/keyboard.h
===================================================================
--- /trunk/include/keyboard.h	(revision 511)
+++ /trunk/include/keyboard.h	(revision 511)
@@ -0,0 +1,36 @@
+#ifndef KEYBOARD_H
+#define KEYBOARD_H
+
+#define KEY_UP		1
+#define KEY_DOWN	2
+#define KEY_LEFT	3
+#define KEY_RIGHT	4
+#define KEY_SET		5
+#define KEY_SHOOT_HALF	6
+#define KEY_SHOOT_FULL	7
+#define KEY_ZOOM_IN	8
+#define KEY_ZOOM_OUT	9
+#define KEY_MENU	10
+#define KEY_DISPLAY	11
+#define KEY_PRINT	12     //S-series: Shortcut
+#define KEY_ERASE	13     //S-series: Func
+#define KEY_ISO		14     //S-series
+#define KEY_FLASH	15     //S-series
+#define KEY_MF		16     //S-series
+#define KEY_MACRO	17     //S-series
+#define KEY_VIDEO	18     //S-series
+#define KEY_TIMER	19     //S-series
+#define KEY_EXPO_CORR	20     //G-series
+#define KEY_MICROPHONE	21
+#define KEY_FACE        22  //SX100IS
+#define KEY_DUMMY	23     //dummy key for pressing to disable energy saving in alt mode
+
+
+
+extern void gui_kbd_process();
+extern void gui_kbd_enter();
+extern void gui_kbd_leave();
+extern void other_kbd_process();
+
+#endif
+
Index: /trunk/include/lauxlib.h
===================================================================
--- /trunk/include/lauxlib.h	(revision 511)
+++ /trunk/include/lauxlib.h	(revision 511)
@@ -0,0 +1,174 @@
+/*
+** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $
+** Auxiliary functions for building Lua libraries
+** See Copyright Notice in lua.h
+*/
+
+
+#ifndef lauxlib_h
+#define lauxlib_h
+
+
+#include <stddef.h>
+#include <stdio.h>
+
+#include "lua.h"
+
+
+#if defined(LUA_COMPAT_GETN)
+LUALIB_API int (luaL_getn) (lua_State *L, int t);
+LUALIB_API void (luaL_setn) (lua_State *L, int t, int n);
+#else
+#define luaL_getn(L,i)          ((int)lua_objlen(L, i))
+#define luaL_setn(L,i,j)        ((void)0)  /* no op! */
+#endif
+
+#if defined(LUA_COMPAT_OPENLIB)
+#define luaI_openlib	luaL_openlib
+#endif
+
+
+/* extra error code for `luaL_load' */
+#define LUA_ERRFILE     (LUA_ERRERR+1)
+
+
+typedef struct luaL_Reg {
+  const char *name;
+  lua_CFunction func;
+} luaL_Reg;
+
+
+
+LUALIB_API void (luaI_openlib) (lua_State *L, const char *libname,
+                                const luaL_Reg *l, int nup);
+LUALIB_API void (luaL_register) (lua_State *L, const char *libname,
+                                const luaL_Reg *l);
+LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);
+LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);
+LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname);
+LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg);
+LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg,
+                                                          size_t *l);
+LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg,
+                                          const char *def, size_t *l);
+LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg);
+LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def);
+
+LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);
+LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,
+                                          lua_Integer def);
+
+LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);
+LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t);
+LUALIB_API void (luaL_checkany) (lua_State *L, int narg);
+
+LUALIB_API int   (luaL_newmetatable) (lua_State *L, const char *tname);
+LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);
+
+LUALIB_API void (luaL_where) (lua_State *L, int lvl);
+LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);
+
+LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
+                                   const char *const lst[]);
+
+LUALIB_API int (luaL_ref) (lua_State *L, int t);
+LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
+
+LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename);
+LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz,
+                                  const char *name);
+LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);
+
+LUALIB_API lua_State *(luaL_newstate) (void);
+
+
+LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,
+                                                  const char *r);
+
+LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx,
+                                         const char *fname, int szhint);
+
+
+
+
+/*
+** ===============================================================
+** some useful macros
+** ===============================================================
+*/
+
+#define luaL_argcheck(L, cond,numarg,extramsg)	\
+		((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))
+#define luaL_checkstring(L,n)	(luaL_checklstring(L, (n), NULL))
+#define luaL_optstring(L,n,d)	(luaL_optlstring(L, (n), (d), NULL))
+#define luaL_checkint(L,n)	((int)luaL_checkinteger(L, (n)))
+#define luaL_optint(L,n,d)	((int)luaL_optinteger(L, (n), (d)))
+#define luaL_checklong(L,n)	((long)luaL_checkinteger(L, (n)))
+#define luaL_optlong(L,n,d)	((long)luaL_optinteger(L, (n), (d)))
+
+#define luaL_typename(L,i)	lua_typename(L, lua_type(L,(i)))
+
+#define luaL_dofile(L, fn) \
+	(luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
+
+#define luaL_dostring(L, s) \
+	(luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
+
+#define luaL_getmetatable(L,n)	(lua_getfield(L, LUA_REGISTRYINDEX, (n)))
+
+#define luaL_opt(L,f,n,d)	(lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
+
+/*
+** {======================================================
+** Generic Buffer manipulation
+** =======================================================
+*/
+
+
+
+typedef struct luaL_Buffer {
+  char *p;			/* current position in buffer */
+  int lvl;  /* number of strings in the stack (level) */
+  lua_State *L;
+  char buffer[LUAL_BUFFERSIZE];
+} luaL_Buffer;
+
+#define luaL_addchar(B,c) \
+  ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \
+   (*(B)->p++ = (char)(c)))
+
+/* compatibility only */
+#define luaL_putchar(B,c)	luaL_addchar(B,c)
+
+#define luaL_addsize(B,n)	((B)->p += (n))
+
+LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);
+LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B);
+LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
+LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s);
+LUALIB_API void (luaL_addvalue) (luaL_Buffer *B);
+LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
+
+
+/* }====================================================== */
+
+
+/* compatibility with ref system */
+
+/* pre-defined references */
+#define LUA_NOREF       (-2)
+#define LUA_REFNIL      (-1)
+
+#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \
+      (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))
+
+#define lua_unref(L,ref)        luaL_unref(L, LUA_REGISTRYINDEX, (ref))
+
+#define lua_getref(L,ref)       lua_rawgeti(L, LUA_REGISTRYINDEX, (ref))
+
+
+#define luaL_reg	luaL_Reg
+
+#endif
+
+
Index: /trunk/include/assert.h
===================================================================
--- /trunk/include/assert.h	(revision 511)
+++ /trunk/include/assert.h	(revision 511)
@@ -0,0 +1,6 @@
+#ifndef ASSERT_H
+#define ASSERT_H
+
+#define assert (void)0
+
+#endif
Index: /trunk/include/limits.h
===================================================================
--- /trunk/include/limits.h	(revision 511)
+++ /trunk/include/limits.h	(revision 511)
@@ -0,0 +1,9 @@
+#ifndef LIMITS_H
+#define LIMITS_H
+
+#define INT_MAX 2147483647
+#define SHRT_MAX 32767
+
+#define UCHAR_MAX 255
+
+#endif
Index: /trunk/include/setjmp.h
===================================================================
--- /trunk/include/setjmp.h	(revision 511)
+++ /trunk/include/setjmp.h	(revision 511)
@@ -0,0 +1,305 @@
+#if defined(__arm__) || defined(__thumb__)
+/*
+ * All callee preserved registers:
+ * v1 - v7, fp, ip, sp, lr, f4, f5, f6, f7
+ */
+#define _JBLEN 23
+#endif
+
+#if defined(__AVR__)
+#define _JBLEN 24
+#endif
+
+#ifdef __sparc__
+/*
+ * onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext).
+ * All else recovered by under/over(flow) handling.
+ */
+#define	_JBLEN	13
+#endif
+
+#ifdef __BFIN__
+#define _JBLEN  40
+#endif
+
+/* necv70 was 9 as well. */
+
+#ifdef __mc68000__
+/*
+ * onsstack,sigmask,sp,pc,psl,d2-d7,a2-a6,
+ * fp2-fp7	for 68881.
+ * All else recovered by under/over(flow) handling.
+ */
+#define	_JBLEN	34
+#endif
+
+#if defined(__mc68hc11__) || defined(__mc68hc12__) || defined(__mc68hc1x__)
+/*
+ * D, X, Y are not saved.
+ * Only take into account the pseudo soft registers (max 32).
+ */
+#define _JBLEN  32
+#endif
+
+#if defined(__Z8001__) || defined(__Z8002__)
+/* 16 regs + pc */
+#define _JBLEN 20
+#endif
+
+#ifdef _AM29K
+/*
+ * onsstack,sigmask,sp,pc,npc,psr,g1,o0,wbcnt (sigcontext).
+ * All else recovered by under/over(flow) handling.
+ */
+#define	_JBLEN	9
+#endif
+
+#if defined(__CYGWIN__) && !defined (_JBLEN)
+#define _JBLEN (13 * 4)
+#elif defined (__i386__)
+#if defined(__unix__) || defined(__rtems__)
+# define _JBLEN	9
+#else
+#include "setjmp-dj.h"
+#endif
+#endif
+
+#ifdef __x86_64__
+#define _JBTYPE long long
+#define _JBLEN  8
+#endif
+
+#ifdef __i960__
+#define _JBLEN 35
+#endif
+
+#ifdef __M32R__
+/* Only 8 words are currently needed.  10 gives us some slop if we need
+   to expand.  */
+#define _JBLEN 10
+#endif
+
+#ifdef __mips__
+#ifdef __mips64
+#define _JBTYPE long long
+#endif
+#ifdef __mips_soft_float
+#define _JBLEN 11
+#else
+#define _JBLEN 23
+#endif
+#endif
+
+#ifdef __m88000__
+#define _JBLEN 21
+#endif
+
+#ifdef __H8300__
+#define _JBLEN 5
+#define _JBTYPE int
+#endif
+
+#ifdef __H8300H__
+/* same as H8/300 but registers are twice as big */
+#define _JBLEN 5
+#define _JBTYPE long
+#endif
+
+#if defined (__H8300S__) || defined (__H8300SX__)
+/* same as H8/300 but registers are twice as big */
+#define _JBLEN 5
+#define _JBTYPE long
+#endif
+
+#ifdef __H8500__
+#define _JBLEN 4
+#endif
+
+#ifdef  __sh__
+#if __SH5__
+#define _JBLEN 50
+#define _JBTYPE long long
+#else
+#define _JBLEN 20
+#endif /* __SH5__ */
+#endif
+
+#ifdef  __v800
+#define _JBLEN 28
+#endif
+
+#ifdef __PPC__
+#ifdef __ALTIVEC__
+#define _JBLEN 64
+#else
+#define _JBLEN 32
+#endif
+#define _JBTYPE double
+#endif
+
+#ifdef __hppa__
+/* %r30, %r2-%r18, %r27, pad, %fr12-%fr15.
+   Note space exists for the FP registers, but they are not
+   saved.  */
+#define _JBLEN 28
+#endif
+
+#if defined(__mn10300__) || defined(__mn10200__)
+#ifdef __AM33_2__
+#define _JBLEN 26
+#else
+/* A guess */
+#define _JBLEN 10
+#endif
+#endif
+
+#ifdef __v850
+/* I think our setjmp is saving 15 regs at the moment.  Gives us one word
+   slop if we need to expand.  */
+#define _JBLEN 16
+#endif
+
+#if defined(_C4x)
+#define _JBLEN 10
+#endif
+#if defined(_C3x)
+#define _JBLEN 9
+#endif
+
+#ifdef __TIC80__
+#define _JBLEN 13
+#endif
+
+#ifdef __D10V__
+#define _JBLEN 8
+#endif
+
+#ifdef __D30V__
+#define _JBLEN ((64 /* GPR */ + (2*2) /* ACs */ + 18 /* CRs */) / 2)
+#define _JBTYPE double
+#endif
+
+#ifdef __frv__
+#define _JBLEN (68/2)  /* room for 68 32-bit regs */
+#define _JBTYPE double
+#endif
+
+#ifdef __CRX__
+#define _JBLEN 9
+#endif
+
+#ifdef __fr30__
+#define _JBLEN 10
+#endif
+
+#ifdef __iq2000__
+#define _JBLEN 32
+#endif
+
+#ifdef __mcore__
+#define _JBLEN 16
+#endif
+
+#ifdef __MMIX__
+/* Using a layout compatible with GCC's built-in.  */
+#define _JBLEN 5
+#define _JBTYPE unsigned long
+#endif
+
+#ifdef __mt__
+#define _JBLEN 16
+#endif
+
+#ifdef __SPU__
+#define _JBLEN 50 
+#define _JBTYPE __vector signed int
+#endif
+
+#ifdef __xstormy16__
+/* 4 GPRs plus SP plus PC. */
+#define _JBLEN 8
+#endif
+
+#ifdef __mep__
+/* 16 GPRs, pc, hi, lo */
+#define _JBLEN 19
+#endif
+
+#ifdef __CRIS__
+#define _JBLEN 18
+#endif
+
+#ifdef __m32c__
+#if defined(__r8c_cpu__) || defined(__m16c_cpu__)
+#define _JBLEN (22/2)
+#else
+#define _JBLEN (34/2)
+#endif
+#define _JBTYPE unsigned short
+#endif /* __m32c__ */
+
+#ifdef _JBLEN
+#ifdef _JBTYPE
+typedef	_JBTYPE jmp_buf[_JBLEN];
+#else
+typedef	int jmp_buf[_JBLEN];
+#endif
+#endif
+
+void longjmp(jmp_buf __jmpb, int __retval);
+int setjmp(jmp_buf __jmpb);
+
+#if defined(__CYGWIN__) || defined(__rtems__)
+#include <signal.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* POSIX sigsetjmp/siglongjmp macros */
+typedef int sigjmp_buf[_JBLEN+2];
+
+#define _SAVEMASK	_JBLEN
+#define _SIGMASK	(_JBLEN+1)
+
+#ifdef __CYGWIN__
+# define _CYGWIN_WORKING_SIGSETJMP
+#endif
+
+#if defined(__GNUC__)
+
+#define sigsetjmp(env, savemask) \
+            __extension__ \
+            ({ \
+              sigjmp_buf *_sjbuf = &(env); \
+              ((*_sjbuf)[_SAVEMASK] = savemask,\
+              sigprocmask (SIG_SETMASK, 0, (sigset_t *)((*_sjbuf) + _SIGMASK)),\
+              setjmp (*_sjbuf)); \
+            })
+
+#define siglongjmp(env, val) \
+            __extension__ \
+            ({ \
+              sigjmp_buf *_sjbuf = &(env); \
+              ((((*_sjbuf)[_SAVEMASK]) ? \
+               sigprocmask (SIG_SETMASK, (sigset_t *)((*_sjbuf) + _SIGMASK), 0)\
+               : 0), \
+               longjmp (*_sjbuf, val)); \
+            })
+
+#else /* !__GNUC__ */
+
+#define sigsetjmp(env, savemask) ((env)[_SAVEMASK] = savemask,\
+               sigprocmask (SIG_SETMASK, 0, (sigset_t *) ((env) + _SIGMASK)),\
+               setjmp (env))
+
+#define siglongjmp(env, val) ((((env)[_SAVEMASK])?\
+               sigprocmask (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\
+               longjmp (env, val))
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __CYGWIN__ or __rtems__ */
Index: /trunk/include/lolevel.h
===================================================================
--- /trunk/include/lolevel.h	(revision 511)
+++ /trunk/include/lolevel.h	(revision 511)
@@ -0,0 +1,199 @@
+#ifndef LOLEVEL_H
+#define LOLEVEL_H
+
+#ifndef LOW_LEVEL
+#error File can be included when platform is built only!
+#endif
+
+#ifndef __arm__
+#error File can be included in ARM mode only!
+#endif
+
+/* Canon stuff */
+extern long *_GetSystemTime(long *t);
+extern long _GetZoomLensCurrentPosition();
+extern long _GetZoomLensCurrentPoint();
+extern long _MoveZoomLensWithPoint(short *pos);
+extern long _SetZoomActuatorSpeedPercent(short *perc);
+extern volatile long zoom_busy;
+extern long _GetFocusLensCurrentPosition();
+extern long _GetFocusLensSubjectDistance();
+extern long _GetFocusLensSubjectDistanceFromLens();
+extern void _MoveFocusLensToDistance(short *dist); 
+extern void _PutInNdFilter();
+extern void _PutOutNdFilter();
+extern volatile long focus_busy;
+extern long _GetCurrentAvValue();
+extern long _GetCurrentTargetDistance();
+extern long _GetPropertyCase(long opt_id, void *buf, long bufsize);
+extern long _SetPropertyCase(long opt_id, void *buf, long bufsize);
+extern long _IsStrobeChargeCompleted();
+extern long _VbattGet();
+extern int _GetBatteryTemperature();
+extern int _GetCCDTemperature();
+extern int _GetOpticalTemperature();
+extern void _PT_PlaySound(short , void*);  
+extern void _RefreshPhysicalScreen(long f);
+extern void _Unmount_FileSystem();
+extern void _Mount_FileSystem();
+extern void _SleepTask(long msec);
+extern int _CreateTask (const char *name, int prio, int stack_size /*?*/, 
+    void *entry, long parm /*?*/);
+extern void _SleepTask(long msec);
+extern void __attribute__((noreturn)) _ExitTask();
+extern int _taskNameToId(char* taskName); // VxWorks only, task's name first letter must be 't', maximum 10 chars total 
+extern const char *_taskName(int taskID); // VxWorks only for now
+extern int _taskIdListGet(int *idlist,int max); // VxWorks only for now
+extern void _taskSuspend(int taskId); 
+extern void _taskResume(int taskId); extern long _GetPropertyCase(long opt_id, void *buf, long bufsize);
+extern long _GetPropertyCase(long opt_id, void *buf, long bufsize);
+extern long _SetPropertyCase(long opt_id, void *buf, long bufsize);
+extern long _IsStrobeChargeCompleted();
+
+long _SetEventFlag(void *flag, long what);
+long _CheckAnyEventFlag(void *flag, long mask, long *res);
+long _GetEventFlagValue(void *flag, long *res);
+
+long _ReceiveMessageQueue(void *msgq, long *dst, long unk1 /* maybe size? */);
+
+/* Canon stuff with nonoriginal naming */
+extern long _GetParameterData(long id, void *buf, long size);
+extern long _SetParameterData(long id, void *buf, long size);
+extern void _UpdateMBROnFlash(int driveno, long offset, char *str);
+
+/* standart C library */
+//extern int _creat (const char *name, int flags);
+extern int _open (const char *name, int flags, int mode );
+extern int _close (int fd);
+extern int _write (int fd, void *buffer, long nbytes);
+extern int _read (int fd, void *buffer, long nbytes);
+extern int _lseek (int fd, long offset, int whence);
+extern long _mkdir(const char *dirname);
+
+extern int _Open (const char *name, int flags, int mode );
+extern int _Close (int fd);
+extern int _Write (int fd, void *buffer, long nbytes);
+extern int _Read (int fd, void *buffer, long nbytes);
+extern int _Lseek (int fd, long offset, int whence);
+extern int _Remove(const char *name);
+
+extern long _Fopen_Fut(const char *filename, const char *mode);
+extern void _Fclose_Fut(long file);
+extern long _Fread_Fut(void *buf, long elsize, long count, long f);
+extern long _Fwrite_Fut(const void *buf, long elsize, long count, long f);
+extern long _Fseek_Fut(long file, long offset, long whence);
+extern long _Fflush_Fut(long file);
+extern int _rename(const char *oldname, const char *newname);
+
+extern int _isdigit(int c);
+extern int _isspace(int c);
+extern int _isalpha(int c);
+extern int _isupper(int c);
+
+extern long _strlen(const char *s);
+extern int _strcmp(const char *s1, const char *s2);
+extern int _strncmp(const char *s1, const char *s2, long n);
+extern char *_strchr(const char *s, int c);
+extern char *_strcpy(char *dest, const char *src);
+extern char *_strncpy(char *dest, const char *src, long n);
+extern char *_strcat(char *dest, const char *app);
+extern char *_strrchr(const char *s, int c);
+extern char *_strpbrk(const char *s, const char *accept);
+
+extern long _strtol(const char *nptr, char **endptr, int base);
+
+extern int _vsprintf(char *buf, const char *fmt, __builtin_va_list va_list);
+
+extern void *_malloc(long size);
+extern void _free(void *p);
+extern void *_AllocateUncacheableMemory(long size);
+extern void _FreeUncacheableMemory(void *p);
+
+extern void *_memcpy(void *dest, const void *src, long n);
+extern void *_memset(void *s, int c, int n);
+extern int _memcmp(const void *s1, const void *s2, long n);
+
+extern void _qsort (void *__base, int __nelem, int __size, int (*__cmp)(const void *__e1, const void *__e2));
+
+/* VxWorks */
+extern long _taskLock();
+extern long _taskUnlock();
+extern int _taskCreateHookAdd (void *createHook);
+extern int _taskDeleteHookAdd (void *deleteHook);
+extern long _iosDevAdd(void*,void*,int);
+extern long _iosDrvInstall(void*,void*,void*,void*,void*,void*,void*);
+extern void _GiveSemaphore(int sem);
+
+/* misc */
+extern const char aPhysw;
+extern long physw_run;
+extern long _kbd_p1_f();
+extern void _kbd_p2_f();
+extern void _kbd_pwr_on();
+extern void _kbd_pwr_off();
+extern void _kbd_read_keys_r2(void*p);
+extern long physw_status[3], physw_copy[3];
+
+void __attribute__((naked,noinline)) mykbd_task();
+extern void capt_seq_task();
+extern void movie_record_task();
+extern void init_file_modules_task();
+
+void kbd_fetch_data(long *dst);
+
+extern long playrec_mode; //used on S-series only
+
+extern void *led_table;
+extern void _UniqueLedOn(void *addr, long brightness);
+extern void _UniqueLedOff(void *addr);
+struct led_control {int led_num; int action; int brightness; int blink_count;};
+extern int _PostLEDMessage(struct led_control *);
+
+
+extern long _LockMainPower();
+extern long _UnlockMainPower();
+extern void _SetAutoShutdownTime(int t);
+
+
+/* math */
+extern int _rand(void);
+extern void* _srand(unsigned int seed);
+
+extern double __log(double x);
+extern double __log10(double x);
+extern double __pow(double x, double y);
+extern double __sqrt(double x);
+
+/* time */
+extern int _utime(char *file, void *newTimes);
+extern unsigned long _time(unsigned long *timer);
+extern void *_localtime(const unsigned long *_tod);
+extern void *_LocalTime(const unsigned long *_tod, void * t_m); // DRYOS
+
+/* file */
+extern void *_opendir(const char* name);
+extern void *_readdir(void *d);
+extern int _ReadFastDir(void *d, void* dd); // DRYOS
+extern int   _closedir(void *d);
+extern void  _rewinddir(void *d);
+extern int   _stat(char *name, void *pStat);
+extern unsigned long _GetDrive_ClusterSize(int drive);
+extern unsigned long _GetDrive_TotalClusters(int drive);
+extern unsigned long _GetDrive_FreeClusters(int drive);
+extern int _WriteSDCard(unsigned int drive, unsigned int start_sect, unsigned int num_sect, void *buf);
+extern void _UnsetZoomForMovie(void);
+void _TurnOffMic(void);
+void _TurnOnMic(void);
+
+extern void _MakeAFScan(int*, int); 
+extern void _ExpCtrlTool_StartContiAE(int, int); 
+extern void _ExpCtrlTool_StopContiAE(int, int); 
+
+extern int some_flag_for_af_scan; 
+extern int parameter_for_af_scan; 
+
+extern void _EnterToCompensationEVF(void);
+extern void _ExitFromCompensationEVF(void);
+
+
+#endif
Index: /trunk/include/script.h
===================================================================
--- /trunk/include/script.h	(revision 511)
+++ /trunk/include/script.h	(revision 511)
@@ -0,0 +1,27 @@
+#ifndef SCRIPT_H
+#define SCRIPT_H
+
+//-------------------------------------------------------------------
+#define SCRIPT_DEFAULT_FILENAME     "A/SCRIPT.BAS"
+#define SCRIPT_NUM_PARAMS           26
+#define SCRIPT_DATA_PATH            "A/CHDK/DATA/"
+
+//-------------------------------------------------------------------
+extern const char *state_ubasic_script;
+
+extern char script_title[36];
+extern char script_params[SCRIPT_NUM_PARAMS][28];
+extern int script_param_order[SCRIPT_NUM_PARAMS];
+
+//-------------------------------------------------------------------
+extern void script_load(const char *fn, int saved_params);
+extern void script_console_clear();
+extern void script_console_add_line(const char *str);
+extern void script_console_draw();
+extern void script_print_screen_init();
+extern void script_print_screen_end();
+extern void script_print_screen_statement(int val);
+extern int load_params_values(const char *fn, int update_vars, int read_param_set);
+extern void save_params_values(int unconditional);
+//-------------------------------------------------------------------
+#endif
Index: /trunk/include/ubasic.h
===================================================================
--- /trunk/include/ubasic.h	(revision 511)
+++ /trunk/include/ubasic.h	(revision 511)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2006, Adam Dunkels
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#ifndef __UBASIC_H__
+#define __UBASIC_H__
+
+enum ubasic_errors
+{
+    UBASIC_E_NONE = 0,
+    UBASIC_E_PARSE,
+    UBASIC_E_UNK_STATEMENT,
+    UBASIC_E_UNK_KEY,
+    UBASIC_E_UNK_LABEL,
+    UBASIC_E_GOSUB_STACK_EXHAUSTED,
+    UBASIC_E_UNMATCHED_RETURN,
+    UBASIC_E_UNKNOWN_ERROR,
+    UBASIC_E_ENDMARK
+};
+
+/** holds short error messages for all known ubasic_errors */
+extern const char *ubasic_errstrings[UBASIC_E_ENDMARK];
+
+extern int ubasic_error;
+
+void ubasic_init(const char *program);
+void ubasic_run(void);
+int ubasic_finished(void);
+void ubasic_end();
+int ubasic_linenumber();
+int jump_label(char * label);
+
+int ubasic_get_variable(int varnum);
+void ubasic_set_variable(int varum, int value);
+
+#endif /* __UBASIC_H__ */
Index: /trunk/include/string.h
===================================================================
--- /trunk/include/string.h	(revision 511)
+++ /trunk/include/string.h	(revision 511)
@@ -0,0 +1,7 @@
+#ifndef STRING_H
+#define STRING_H
+
+#include <stdlib.h>
+#define strcoll strcmp
+
+#endif
Index: /trunk/include/font.h
===================================================================
--- /trunk/include/font.h	(revision 511)
+++ /trunk/include/font.h	(revision 511)
@@ -0,0 +1,45 @@
+#ifndef FONT_H
+#define FONT_H
+
+#include "gui.h"
+
+//-------------------------------------------------------------------
+#define FONT_CP_WIN     0
+#define FONT_CP_DOS     1
+
+#define  FONT_CP_WIN_1250       0
+#define  FONT_CP_WIN_1251       1
+#define  FONT_CP_WIN_1252       2
+#define  FONT_CP_WIN_1254       3
+#define  FONT_CP_WIN_1257       4
+
+//-------------------------------------------------------------------
+extern unsigned char current_font[256][16];
+
+//-------------------------------------------------------------------
+extern void font_init();
+extern void font_set(int codepage);
+
+extern int rbf_load(char *file);
+extern int rbf_load_symbol(char *file);
+extern void rbf_load_from_8x16(unsigned char font[256][16]);
+extern int rbf_font_height();
+extern int rbf_symbol_height();
+extern int rbf_char_width(int ch);
+extern int rbf_symbol_width(int ch);
+extern int rbf_str_width(const char *str);
+extern void rbf_set_codepage(int codepage);
+extern int rbf_draw_char(int x, int y, int ch, color cl);
+extern int rbf_draw_symbol(int x, int y, int ch, color cl);
+extern int rbf_draw_string(int x, int y, const char *str, color cl);
+extern int rbf_draw_string_c(int x, int y, const char *str, color cl1, int c, color cl2);
+extern int rbf_draw_string_len(int x, int y, int len, const char *str, color cl);
+extern int rbf_draw_string_right_len(int x, int y, int len, const char *str, color cl);
+extern int rbf_draw_string_center_len(int x, int y, int len, char symbol, const char *str, color cl);
+
+//-------------------------------------------------------------------
+#endif
+
+
+
+
Index: /trunk/include/lualib.h
===================================================================
--- /trunk/include/lualib.h	(revision 511)
+++ /trunk/include/lualib.h	(revision 511)
@@ -0,0 +1,53 @@
+/*
+** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $
+** Lua standard libraries
+** See Copyright Notice in lua.h
+*/
+
+
+#ifndef lualib_h
+#define lualib_h
+
+#include "lua.h"
+
+
+/* Key to file-handle type */
+#define LUA_FILEHANDLE		"FILE*"
+
+
+#define LUA_COLIBNAME	"coroutine"
+LUALIB_API int (luaopen_base) (lua_State *L);
+
+#define LUA_TABLIBNAME	"table"
+LUALIB_API int (luaopen_table) (lua_State *L);
+
+#define LUA_IOLIBNAME	"io"
+LUALIB_API int (luaopen_io) (lua_State *L);
+
+#define LUA_OSLIBNAME	"os"
+LUALIB_API int (luaopen_os) (lua_State *L);
+
+#define LUA_STRLIBNAME	"string"
+LUALIB_API int (luaopen_string) (lua_State *L);
+
+#define LUA_MATHLIBNAME	"math"
+LUALIB_API int (luaopen_math) (lua_State *L);
+
+#define LUA_DBLIBNAME	"debug"
+LUALIB_API int (luaopen_debug) (lua_State *L);
+
+#define LUA_LOADLIBNAME	"package"
+LUALIB_API int (luaopen_package) (lua_State *L);
+
+
+/* open all previous libraries */
+LUALIB_API void (luaL_openlibs) (lua_State *L); 
+
+
+
+#ifndef lua_assert
+#define lua_assert(x)	((void)0)
+#endif
+
+
+#endif
Index: /trunk/include/stddef.h
===================================================================
--- /trunk/include/stddef.h	(revision 511)
+++ /trunk/include/stddef.h	(revision 511)
@@ -0,0 +1,9 @@
+#ifndef STDDEF_H
+#define STDDEF_H
+
+typedef unsigned int size_t;
+typedef int ssize_t;
+typedef int ptrdiff_t;
+#define NULL ((void*)0)
+
+#endif
Index: /trunk/include/lua.h
===================================================================
--- /trunk/include/lua.h	(revision 511)
+++ /trunk/include/lua.h	(revision 511)
@@ -0,0 +1,388 @@
+/*
+** $Id: lua.h,v 1.218.1.4 2008/01/03 15:41:15 roberto Exp $
+** Lua - An Extensible Extension Language
+** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
+** See Copyright Notice at the end of this file
+*/
+
+
+#ifndef lua_h
+#define lua_h
+
+#include <stdarg.h>
+#include <stddef.h>
+
+
+#include "luaconf.h"
+
+
+#define LUA_VERSION	"Lua 5.1"
+#define LUA_RELEASE	"Lua 5.1.3"
+#define LUA_VERSION_NUM	501
+#define LUA_COPYRIGHT	"Copyright (C) 1994-2008 Lua.org, PUC-Rio"
+#define LUA_AUTHORS 	"R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
+
+
+/* mark for precompiled code (`<esc>Lua') */
+#define	LUA_SIGNATURE	"\033Lua"
+
+/* option for multiple returns in `lua_pcall' and `lua_call' */
+#define LUA_MULTRET	(-1)
+
+
+/*
+** pseudo-indices
+*/
+#define LUA_REGISTRYINDEX	(-10000)
+#define LUA_ENVIRONINDEX	(-10001)
+#define LUA_GLOBALSINDEX	(-10002)
+#define lua_upvalueindex(i)	(LUA_GLOBALSINDEX-(i))
+
+
+/* thread status; 0 is OK */
+#define LUA_YIELD	1
+#define LUA_ERRRUN	2
+#define LUA_ERRSYNTAX	3
+#define LUA_ERRMEM	4
+#define LUA_ERRERR	5
+
+
+typedef struct lua_State lua_State;
+
+typedef int (*lua_CFunction) (lua_State *L);
+
+
+/*
+** functions that read/write blocks when loading/dumping Lua chunks
+*/
+typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);
+
+typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud);
+
+
+/*
+** prototype for memory-allocation functions
+*/
+typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
+
+
+/*
+** basic types
+*/
+#define LUA_TNONE		(-1)
+
+#define LUA_TNIL		0
+#define LUA_TBOOLEAN		1
+#define LUA_TLIGHTUSERDATA	2
+#define LUA_TNUMBER		3
+#define LUA_TSTRING		4
+#define LUA_TTABLE		5
+#define LUA_TFUNCTION		6
+#define LUA_TUSERDATA		7
+#define LUA_TTHREAD		8
+
+
+
+/* minimum Lua stack available to a C function */
+#define LUA_MINSTACK	20
+
+
+/*
+** generic extra include file
+*/
+#if defined(LUA_USER_H)
+#include LUA_USER_H
+#endif
+
+
+/* type of numbers in Lua */
+typedef LUA_NUMBER lua_Number;
+
+
+/* type for integer functions */
+typedef LUA_INTEGER lua_Integer;
+
+
+
+/*
+** state manipulation
+*/
+LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);
+LUA_API void       (lua_close) (lua_State *L);
+LUA_API lua_State *(lua_newthread) (lua_State *L);
+
+LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);
+
+
+/*
+** basic stack manipulation
+*/
+LUA_API int   (lua_gettop) (lua_State *L);
+LUA_API void  (lua_settop) (lua_State *L, int idx);
+LUA_API void  (lua_pushvalue) (lua_State *L, int idx);
+LUA_API void  (lua_remove) (lua_State *L, int idx);
+LUA_API void  (lua_insert) (lua_State *L, int idx);
+LUA_API void  (lua_replace) (lua_State *L, int idx);
+LUA_API int   (lua_checkstack) (lua_State *L, int sz);
+
+LUA_API void  (lua_xmove) (lua_State *from, lua_State *to, int n);
+
+
+/*
+** access functions (stack -> C)
+*/
+
+LUA_API int             (lua_isnumber) (lua_State *L, int idx);
+LUA_API int             (lua_isstring) (lua_State *L, int idx);
+LUA_API int             (lua_iscfunction) (lua_State *L, int idx);
+LUA_API int             (lua_isuserdata) (lua_State *L, int idx);
+LUA_API int             (lua_type) (lua_State *L, int idx);
+LUA_API const char     *(lua_typename) (lua_State *L, int tp);
+
+LUA_API int            (lua_equal) (lua_State *L, int idx1, int idx2);
+LUA_API int            (lua_rawequal) (lua_State *L, int idx1, int idx2);
+LUA_API int            (lua_lessthan) (lua_State *L, int idx1, int idx2);
+
+LUA_API lua_Number      (lua_tonumber) (lua_State *L, int idx);
+LUA_API lua_Integer     (lua_tointeger) (lua_State *L, int idx);
+LUA_API int             (lua_toboolean) (lua_State *L, int idx);
+LUA_API const char     *(lua_tolstring) (lua_State *L, int idx, size_t *len);
+LUA_API size_t          (lua_objlen) (lua_State *L, int idx);
+LUA_API lua_CFunction   (lua_tocfunction) (lua_State *L, int idx);
+LUA_API void	       *(lua_touserdata) (lua_State *L, int idx);
+LUA_API lua_State      *(lua_tothread) (lua_State *L, int idx);
+LUA_API const void     *(lua_topointer) (lua_State *L, int idx);
+
+
+/*
+** push functions (C -> stack)
+*/
+LUA_API void  (lua_pushnil) (lua_State *L);
+LUA_API void  (lua_pushnumber) (lua_State *L, lua_Number n);
+LUA_API void  (lua_pushinteger) (lua_State *L, lua_Integer n);
+LUA_API void  (lua_pushlstring) (lua_State *L, const char *s, size_t l);
+LUA_API void  (lua_pushstring) (lua_State *L, const char *s);
+LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt,
+                                                      va_list argp);
+LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...);
+LUA_API void  (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
+LUA_API void  (lua_pushboolean) (lua_State *L, int b);
+LUA_API void  (lua_pushlightuserdata) (lua_State *L, void *p);
+LUA_API int   (lua_pushthread) (lua_State *L);
+
+
+/*
+** get functions (Lua -> stack)
+*/
+LUA_API void  (lua_gettable) (lua_State *L, int idx);
+LUA_API void  (lua_getfield) (lua_State *L, int idx, const char *k);
+LUA_API void  (lua_rawget) (lua_State *L, int idx);
+LUA_API void  (lua_rawgeti) (lua_State *L, int idx, int n);
+LUA_API void  (lua_createtable) (lua_State *L, int narr, int nrec);
+LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);
+LUA_API int   (lua_getmetatable) (lua_State *L, int objindex);
+LUA_API void  (lua_getfenv) (lua_State *L, int idx);
+
+
+/*
+** set functions (stack -> Lua)
+*/
+LUA_API void  (lua_settable) (lua_State *L, int idx);
+LUA_API void  (lua_setfield) (lua_State *L, int idx, const char *k);
+LUA_API void  (lua_rawset) (lua_State *L, int idx);
+LUA_API void  (lua_rawseti) (lua_State *L, int idx, int n);
+LUA_API int   (lua_setmetatable) (lua_State *L, int objindex);
+LUA_API int   (lua_setfenv) (lua_State *L, int idx);
+
+
+/*
+** `load' and `call' functions (load and run Lua code)
+*/
+LUA_API void  (lua_call) (lua_State *L, int nargs, int nresults);
+LUA_API int   (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc);
+LUA_API int   (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud);
+LUA_API int   (lua_load) (lua_State *L, lua_Reader reader, void *dt,
+                                        const char *chunkname);
+
+LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data);
+
+
+/*
+** coroutine functions
+*/
+LUA_API int  (lua_yield) (lua_State *L, int nresults);
+LUA_API int  (lua_resume) (lua_State *L, int narg);
+LUA_API int  (lua_status) (lua_State *L);
+
+/*
+** garbage-collection function and options
+*/
+
+#define LUA_GCSTOP		0
+#define LUA_GCRESTART		1
+#define LUA_GCCOLLECT		2
+#define LUA_GCCOUNT		3
+#define LUA_GCCOUNTB		4
+#define LUA_GCSTEP		5
+#define LUA_GCSETPAUSE		6
+#define LUA_GCSETSTEPMUL	7
+
+LUA_API int (lua_gc) (lua_State *L, int what, int data);
+
+
+/*
+** miscellaneous functions
+*/
+
+LUA_API int   (lua_error) (lua_State *L);
+
+LUA_API int   (lua_next) (lua_State *L, int idx);
+
+LUA_API void  (lua_concat) (lua_State *L, int n);
+
+LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);
+LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
+
+
+
+/* 
+** ===============================================================
+** some useful macros
+** ===============================================================
+*/
+
+#define lua_pop(L,n)		lua_settop(L, -(n)-1)
+
+#define lua_newtable(L)		lua_createtable(L, 0, 0)
+
+#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))
+
+#define lua_pushcfunction(L,f)	lua_pushcclosure(L, (f), 0)
+
+#define lua_strlen(L,i)		lua_objlen(L, (i))
+
+#define lua_isfunction(L,n)	(lua_type(L, (n)) == LUA_TFUNCTION)
+#define lua_istable(L,n)	(lua_type(L, (n)) == LUA_TTABLE)
+#define lua_islightuserdata(L,n)	(lua_type(L, (n)) == LUA_TLIGHTUSERDATA)
+#define lua_isnil(L,n)		(lua_type(L, (n)) == LUA_TNIL)
+#define lua_isboolean(L,n)	(lua_type(L, (n)) == LUA_TBOOLEAN)
+#define lua_isthread(L,n)	(lua_type(L, (n)) == LUA_TTHREAD)
+#define lua_isnone(L,n)		(lua_type(L, (n)) == LUA_TNONE)
+#define lua_isnoneornil(L, n)	(lua_type(L, (n)) <= 0)
+
+#define lua_pushliteral(L, s)	\
+	lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)
+
+#define lua_setglobal(L,s)	lua_setfield(L, LUA_GLOBALSINDEX, (s))
+#define lua_getglobal(L,s)	lua_getfield(L, LUA_GLOBALSINDEX, (s))
+
+#define lua_tostring(L,i)	lua_tolstring(L, (i), NULL)
+
+
+
+/*
+** compatibility macros and functions
+*/
+
+#define lua_open()	luaL_newstate()
+
+#define lua_getregistry(L)	lua_pushvalue(L, LUA_REGISTRYINDEX)
+
+#define lua_getgccount(L)	lua_gc(L, LUA_GCCOUNT, 0)
+
+#define lua_Chunkreader		lua_Reader
+#define lua_Chunkwriter		lua_Writer
+
+
+/* hack */
+LUA_API void lua_setlevel	(lua_State *from, lua_State *to);
+
+
+/*
+** {======================================================================
+** Debug API
+** =======================================================================
+*/
+
+
+/*
+** Event codes
+*/
+#define LUA_HOOKCALL	0
+#define LUA_HOOKRET	1
+#define LUA_HOOKLINE	2
+#define LUA_HOOKCOUNT	3
+#define LUA_HOOKTAILRET 4
+
+
+/*
+** Event masks
+*/
+#define LUA_MASKCALL	(1 << LUA_HOOKCALL)
+#define LUA_MASKRET	(1 << LUA_HOOKRET)
+#define LUA_MASKLINE	(1 << LUA_HOOKLINE)
+#define LUA_MASKCOUNT	(1 << LUA_HOOKCOUNT)
+
+typedef struct lua_Debug lua_Debug;  /* activation record */
+
+
+/* Functions to be called by the debuger in specific events */
+typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
+
+
+LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar);
+LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
+LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
+LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
+LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n);
+LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n);
+
+LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count);
+LUA_API lua_Hook lua_gethook (lua_State *L);
+LUA_API int lua_gethookmask (lua_State *L);
+LUA_API int lua_gethookcount (lua_State *L);
+
+
+struct lua_Debug {
+  int event;
+  const char *name;	/* (n) */
+  const char *namewhat;	/* (n) `global', `local', `field', `method' */
+  const char *what;	/* (S) `Lua', `C', `main', `tail' */
+  const char *source;	/* (S) */
+  int currentline;	/* (l) */
+  int nups;		/* (u) number of upvalues */
+  int linedefined;	/* (S) */
+  int lastlinedefined;	/* (S) */
+  char short_src[LUA_IDSIZE]; /* (S) */
+  /* private part */
+  int i_ci;  /* active function */
+};
+
+/* }====================================================================== */
+
+
+/******************************************************************************
+* Copyright (C) 1994-2008 Lua.org, PUC-Rio.  All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining
+* a copy of this software and associated documentation files (the
+* "Software"), to deal in the Software without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, sublicense, and/or sell copies of the Software, and to
+* permit persons to whom the Software is furnished to do so, subject to
+* the following conditions:
+*
+* The above copyright notice and this permission notice shall be
+* included in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+******************************************************************************/
+
+
+#endif
Index: /trunk/include/lang.h
===================================================================
--- /trunk/include/lang.h	(revision 511)
+++ /trunk/include/lang.h	(revision 511)
@@ -0,0 +1,13 @@
+#ifndef LANG_H
+#define LANG_H
+
+//-------------------------------------------------------------------
+extern void lang_init(int num);
+
+extern void lang_load_from_mem(char *buf);
+extern void lang_load_from_file(const char *filename);
+
+extern char* lang_str(int str);
+
+//-------------------------------------------------------------------
+#endif
Index: /trunk/include/stdlib.h
===================================================================
--- /trunk/include/stdlib.h	(revision 511)
+++ /trunk/include/stdlib.h	(revision 511)
@@ -0,0 +1,227 @@
+#include "camera.h"
+
+#ifndef STDLIB_H
+#define STDLIB_H
+
+#define NULL		((void*)0)
+
+#define SEEK_SET        0
+#define SEEK_CUR        1
+#define SEEK_END        2
+
+#define O_RDONLY        0
+#define O_WRONLY        1
+#define O_RDWR          2
+
+
+#if !CAM_DRYOS
+
+#define O_TRUNC         0x400
+#define O_CREAT         0x200
+
+struct	stat
+    {
+    unsigned long	st_dev;		/* device ID number */
+    unsigned long	st_ino;		/* file serial number */
+    unsigned short	st_mode;	/* file mode (see below) */
+    short		st_nlink;	/* number of links to file */
+    short		st_uid;		/* user ID of file's owner */
+    short		st_gid;		/* group ID of file's group */
+    unsigned long	st_rdev;	/* device ID, only if special file */
+    unsigned long	st_size;	/* size of file, in bytes */
+    unsigned long	st_atime;	/* time of last access */
+    unsigned long	st_mtime;	/* time of last modification */
+    unsigned long	st_ctime;	/* time of last change of file status */
+    long		st_blksize;
+    long		st_blocks;
+    unsigned char	st_attrib;	/* file attribute byte (dosFs only) */
+    int			reserved1;	/* reserved for future use */
+    int			reserved2;	/* reserved for future use */
+    int			reserved3;	/* reserved for future use */
+    int			reserved4;	/* reserved for future use */
+    int			reserved5;	/* reserved for future use */
+    int			reserved6;	/* reserved for future use */
+};
+
+#else
+
+#define O_TRUNC         0x200
+#define O_CREAT         0x100
+
+struct	stat
+    {
+    unsigned long	st_dev;		//?
+    unsigned long	st_ino;		//?	
+    unsigned short	st_mode;	//?	
+    short		st_nlink;	//?	
+    short		st_uid;		//?	
+    short		st_gid;		//?	
+    unsigned long	st_atime;	//?	
+    unsigned long	st_mtime;	//?	
+    unsigned long	st_ctime;	//?	
+    unsigned long	st_size;	
+    long		st_blksize;	//?
+    long		st_blocks;	//?
+    unsigned char	st_attrib;
+    int			reserved1;	//	
+    int			reserved2;	//
+    int			reserved3;	//
+    int			reserved4;	//
+    int			reserved5;	//
+    int			reserved6;	//
+};
+
+#endif
+
+extern int rand(void);
+extern void* srand(unsigned int seed);
+
+extern void qsort (void *__base, int __nelem, int __size, int (*__cmp)(const void *__e1, const void *__e2));
+
+extern int isdigit(int c);
+extern int isspace(int c);
+extern int isalpha(int c);
+extern int isupper(int c);
+
+extern long sprintf(char *s, const char *st, ...);
+
+extern long strlen(const char *s);
+extern int strcmp(const char *s1, const char *s2);
+extern int strncmp(const char *s1, const char *s2, long n);
+extern char *strchr(const char *s, int c);
+extern char *strcpy(char *dest, const char *src);
+extern char *strncpy(char *dest, const char *src, long n);
+extern char *strcat(char *dest, const char *app);
+extern char *strrchr(const char *s, int c);
+extern char *strpbrk(const char *s, const char *accept);
+
+extern long strtol(const char *nptr, char **endptr, int base);
+#define atoi(n) strtol((n),NULL,0)
+
+extern void *malloc(long size);
+extern void free(void *p);
+extern void *umalloc(long size);
+extern void ufree(void *p);
+
+extern void *memcpy(void *dest, const void *src, long n);
+extern void *memset(void *s, int c, int n);
+extern int memcmp(const void *s1, const void *s2, long n);
+
+
+extern void SleepTask(long msec);
+extern long mkdir(const char *dirname);
+extern long taskLock();
+extern long taskUnlock();
+
+extern long Fopen_Fut(const char *filename, const char *mode);
+extern void Fclose_Fut(long file);
+extern long Fread_Fut(void *buf, long elsize, long count, long f);
+extern long Fwrite_Fut(const void *buf, long elsize, long count, long f);
+extern long Fseek_Fut(long file, long offset, long whence);
+extern long RenameFile_Fut(const char *oldname, const char *newname);
+extern long Feof_Fut(long file);
+extern long DeleteFile_Fut(const char *name);
+extern long Fflush_Fut(long file);
+
+extern int creat (const char *name, int flags);
+extern int open (const char *name, int flags, int mode );
+extern int close (int fd);
+extern int write (int fd, const void *buffer, long nbytes);
+extern int read (int fd, void *buffer, long nbytes);
+extern int lseek (int fd, long offset, int whence);
+extern long mkdir(const char *dirname);
+
+#define fopen(a,b) Fopen_Fut(a,b)
+#define fclose(a) Fclose_Fut(a)
+#define fread(a,b,c,d) Fread_Fut(a,b,c,d)
+#define fwrite(a,b,c,d) Fwrite_Fut(a,b,c,d)
+#define fseek(a,b,c) Fseek_Fut(a,b,c)
+#define fflush(a) Fflush_Fut(a)
+#define feof(a) Feof_Fut(a)
+#define fdelete(a) DeleteFile_Fut(a)
+
+typedef long FILE;
+
+/**
+ * No STUBS!
+ * You can't use these two directly from THUMB code (core), only from platform.
+ */
+extern int fprintf(FILE *fd, char*buf, ...);
+extern int printf(char *buf, ...);
+
+extern void msleep(long msec);
+extern long task_lock();
+extern long task_unlock();
+extern const char *task_name(int id);
+int task_id_list_get(int *idlist,int size);
+
+#define DOS_ATTR_RDONLY         0x01            /* read-only file */
+#define DOS_ATTR_HIDDEN         0x02            /* hidden file */
+#define DOS_ATTR_SYSTEM         0x04            /* system file */
+#define DOS_ATTR_VOL_LABEL      0x08            /* volume label (not a file) */
+#define DOS_ATTR_DIRECTORY      0x10            /* entry is a sub-directory */
+#define DOS_ATTR_ARCHIVE        0x20            /* file subject to archiving */
+
+#if !CAM_DRYOS
+struct dirent {
+    char                name[100];
+};
+#else
+struct dirent {
+    char                name[13];
+    unsigned long	unk1;
+    unsigned char 	attrib;
+    unsigned long 	size;
+    unsigned long	time1;
+    unsigned long	time2;
+    unsigned long	time3;
+};
+#endif
+
+typedef struct {
+    unsigned int        fd;
+    unsigned int        loc;
+    struct dirent       dir;
+} DIR;
+
+
+
+extern DIR*           opendir (const char* name);
+extern struct dirent* readdir (DIR*);
+extern int            closedir (DIR*);
+extern void           rewinddir (DIR*);
+extern int            stat (char *name, struct stat *pStat);
+
+
+struct tm
+	{
+	int tm_sec;	/* seconds after the minute	- [0, 59] */
+	int tm_min;	/* minutes after the hour	- [0, 59] */
+	int tm_hour;	/* hours after midnight		- [0, 23] */
+	int tm_mday;	/* day of the month		- [1, 31] */
+	int tm_mon;	/* months since January		- [0, 11] */
+	int tm_year;	/* years since 1900	*/
+	int tm_wday;	/* days since Sunday		- [0, 6] */
+	int tm_yday;	/* days since January 1		- [0, 365] */
+	int tm_isdst;	/* Daylight Saving Time flag */
+	};
+
+extern struct tm * localtime(const unsigned long *_tod);
+
+extern int rename(const char *oldname, const char *newname);
+extern int chdir(char *pathname);
+extern int remove(const char *name);
+
+struct utimbuf {
+    unsigned long actime;       /* set the access time */
+    unsigned long modtime;      /* set the modification time */
+};
+
+extern int utime(char *file, struct utimbuf *newTimes);
+extern unsigned long time(unsigned long *timer);
+
+static inline int abs( int v ) {
+  return v<0 ? -v : v;
+}
+
+#endif
Index: /trunk/include/stdio.h
===================================================================
--- /trunk/include/stdio.h	(revision 511)
+++ /trunk/include/stdio.h	(revision 511)
@@ -0,0 +1,1 @@
+
Index: /trunk/include/gui.h
===================================================================
--- /trunk/include/gui.h	(revision 511)
+++ /trunk/include/gui.h	(revision 511)
@@ -0,0 +1,32 @@
+#ifndef GUI_H
+#define GUI_H
+
+typedef unsigned int    coord;
+typedef unsigned short 	color;
+
+#define MAKE_COLOR(bg, fg)	((color)((((char)(bg))<<8)|((char)(fg))))
+
+enum Gui_Mode { GUI_MODE_NONE = 0,
+                GUI_MODE_ALT,
+                GUI_MODE_MENU,
+                GUI_MODE_PALETTE,
+                GUI_MODE_MBOX,
+                GUI_MODE_REVERSI,
+                GUI_MODE_SOKOBAN,
+                GUI_MODE_DEBUG,
+                GUI_MODE_FSELECT,
+                GUI_MODE_READ,
+                GUI_MODE_OSD,
+                GUI_MODE_CALENDAR,
+                GUI_MODE_BENCH,
+                GUI_MODE_MPOPUP };
+
+extern void gui_redraw();
+extern void gui_force_restore();
+
+extern void draw_pixel(coord x, coord y, color cl);
+
+extern enum Gui_Mode gui_get_mode();
+extern void gui_set_mode(enum Gui_Mode mode);
+extern void gui_update_script_submenu();
+#endif
Index: /trunk/include/ctype.h
===================================================================
--- /trunk/include/ctype.h	(revision 511)
+++ /trunk/include/ctype.h	(revision 511)
@@ -0,0 +1,16 @@
+#ifndef CTYPE_H
+#define CTYPE_H
+
+#include <stdlib.h>
+
+static inline int iscntrl( int c )
+{
+  return 0;
+}
+
+static inline int isalnum( int c )
+{
+  return isalpha(c) || isdigit(c);
+}
+
+#endif
Index: /trunk/include/platform.h
===================================================================
--- /trunk/include/platform.h	(revision 511)
+++ /trunk/include/platform.h	(revision 511)
@@ -0,0 +1,534 @@
+#ifndef PLATFORM_H
+#define PLATFORM_H
+
+#include "camera.h"
+
+#define SSID_INVALID (-32767)
+#define ASID_INVALID (-32767)
+
+#define MODE_MASK               0x0300
+#define MODE_REC                0x0100
+#define MODE_PLAY               0x0200
+
+#define MODE_SHOOTING_MASK      0x00FF
+
+enum {
+MODE_AUTO               =1,
+MODE_P                  ,
+MODE_TV                 ,
+MODE_AV                 ,
+MODE_M                  ,
+MODE_PORTRAIT           ,
+MODE_NIGHT              ,
+MODE_LANDSCAPE          ,
+MODE_VIDEO_STD          ,
+MODE_VIDEO_SPEED        ,
+MODE_VIDEO_COMPACT      ,
+MODE_VIDEO_MY_COLORS    ,
+MODE_VIDEO_COLOR_ACCENT ,
+MODE_VIDEO_COLOR_SWAP   ,
+MODE_STITCH             ,
+MODE_MY_COLORS          ,
+MODE_SCN_WATER          ,
+MODE_SCN_NIGHT          ,
+MODE_SCN_CHILD          ,
+MODE_SCN_PARTY          ,
+MODE_SCN_GRASS          ,
+MODE_SCN_SNOW           ,
+MODE_SCN_BEACH          ,
+MODE_SCN_FIREWORK       ,
+MODE_SCN_COLOR_ACCENT   ,
+MODE_SCN_COLOR_SWAP     ,
+MODE_VIDEO_HIRES        ,
+MODE_SCN_AQUARIUM       ,
+MODE_COLOR_ACCENT       ,
+MODE_SCN_NIGHT1         ,
+MODE_SCN_ISO_3200       ,
+MODE_SCN_SPORT          ,
+MODE_SCN_KIDS_PETS      ,
+MODE_INDOOR             ,
+MODE_KIDS_PETS          ,
+MODE_NIGHT_SNAPSHOT     ,
+MODE_DIGITAL_MACRO      ,
+MODE_SCN_FOLIAGE        ,
+MODE_VIDEO_TIME_LAPSE   ,
+MODE_SCN_INDOOR         ,
+MODE_SCN_PORTRAIT       ,
+MODE_SUPER_MACRO        ,
+MODE_VIDEO_PORTRAIT     ,
+MODE_VIDEO_NIGHT        ,
+MODE_VIDEO_INDOOR       ,
+MODE_VIDEO_FOLIAGE      ,
+MODE_VIDEO_SNOW         ,
+MODE_VIDEO_BEACH        ,
+MODE_VIDEO_AQUARIUM     ,
+MODE_VIDEO_SUPER_MACRO  ,
+MODE_VIDEO_STITCH       ,
+MODE_VIDEO_MANUAL       ,
+MODE_SPORTS			    ,
+};
+
+// this is nasty, but not as nasty as checking each of the flags all over the place
+#define MODE_IS_VIDEO(m)   (((m)&MODE_SHOOTING_MASK)==MODE_VIDEO_STD || \
+                            ((m)&MODE_SHOOTING_MASK)==MODE_VIDEO_SPEED ||  \
+                            ((m)&MODE_SHOOTING_MASK)==MODE_VIDEO_COMPACT || \
+                            ((m)&MODE_SHOOTING_MASK)==MODE_VIDEO_MY_COLORS || \
+                            ((m)&MODE_SHOOTING_MASK)==MODE_VIDEO_COLOR_ACCENT || \
+                            ((m)&MODE_SHOOTING_MASK)==MODE_VIDEO_COLOR_SWAP || \
+                            ((m)&MODE_SHOOTING_MASK)==MODE_VIDEO_TIME_LAPSE || \
+                            ((m)&MODE_SHOOTING_MASK)==MODE_VIDEO_PORTRAIT || \
+                            ((m)&MODE_SHOOTING_MASK)==MODE_VIDEO_NIGHT || \
+                            ((m)&MODE_SHOOTING_MASK)==MODE_VIDEO_INDOOR || \
+                            ((m)&MODE_SHOOTING_MASK)==MODE_VIDEO_FOLIAGE || \
+                            ((m)&MODE_SHOOTING_MASK)==MODE_VIDEO_SNOW  || \
+                            ((m)&MODE_SHOOTING_MASK)==MODE_VIDEO_BEACH || \
+                            ((m)&MODE_SHOOTING_MASK)==MODE_VIDEO_AQUARIUM || \
+                            ((m)&MODE_SHOOTING_MASK)==MODE_VIDEO_SUPER_MACRO || \
+                            ((m)&MODE_SHOOTING_MASK)==MODE_VIDEO_STITCH || \
+                            ((m)&MODE_SHOOTING_MASK)==MODE_VIDEO_MANUAL)
+#if CAM_PROPSET == 2     // most digic3 cameras
+ #define PROPCASE_DRIVE_MODE					102
+ #define PROPCASE_FOCUS_MODE					133
+ #define PROPCASE_FLASH_MODE    		        143
+ #define PROPCASE_USER_TV       				264
+ #define PROPCASE_TV	        				262
+ #define PROPCASE_USER_AV      					26
+ #define PROPCASE_AV            				23
+ #define PROPCASE_MIN_AV       					25
+ #define PROPCASE_SV            				247
+ #define PROPCASE_DELTA_SV      				79
+ #define PROPCASE_SV_MARKET     				246
+ #define PROPCASE_BV            				34
+ #define PROPCASE_SUBJECT_DIST1 				245
+ #define PROPCASE_SUBJECT_DIST2 				65
+ #define PROPCASE_ISO_MODE		    			149
+ #define PROPCASE_SHOOTING      				206
+ #define PROPCASE_IS_FLASH_READY      			208
+ #define PROPCASE_OVEREXPOSURE 					103
+ #define PROPCASE_SHOOTING_MODE					49
+ #define PROPCASE_IS_MODE					    145
+ #define PROPCASE_QUALITY				        57
+ #define PROPCASE_RESOLUTION				        218
+ #define PROPCASE_EV_CORRECTION_1				107
+ #define PROPCASE_EV_CORRECTION_2				207
+ #define PROPCASE_ORIENTATION_SENSOR			219
+ #define PROPCASE_DIGITAL_ZOOM_STATE                            94
+ #define PROPCASE_DIGITAL_ZOOM_POSITION                         95
+ #define PROPCASE_DISPLAY_MODE                         105
+ #define PROPCASE_BRACKET_MODE                         278 //fictional value! need to find out!
+#elif CAM_PROPSET == 1   // most digic2 cameras
+ #define PROPCASE_DRIVE_MODE    				6
+ #define PROPCASE_FOCUS_MODE    				12
+ #define PROPCASE_FLASH_MODE       				16
+// need corresponding values for propset2!!!
+// #define PROPCASE_FLASH_ADJUST_MODE       	15
+// #define PROPCASE_FLASH_CORRECTION               28      
+// #define PROPCASE_FLASH_MANUAL_OUTPUT    29
+//  #define PROPCASE_FOCUS_OK           67
+ #define PROPCASE_USER_TV       				40
+ #define PROPCASE_TV	        				69
+ #define PROPCASE_USER_AV       				39
+ #define PROPCASE_AV            				68
+ #define PROPCASE_MIN_AV        				77
+ #define PROPCASE_SV            				73
+ #define PROPCASE_DELTA_SV      				70
+ #define PROPCASE_SV_MARKET     				72
+ #define PROPCASE_BV            				71
+ #define PROPCASE_ISO_MODE      				21
+ #define PROPCASE_SUBJECT_DIST1 				65
+ #define PROPCASE_SUBJECT_DIST2 				66
+ #define PROPCASE_SHOOTING     					205
+ #define PROPCASE_IS_FLASH_READY   				221
+ #define PROPCASE_OVEREXPOSURE 					76
+ #define PROPCASE_SHOOTING_MODE					0
+ #define PROPCASE_IS_MODE				        229
+ #define PROPCASE_QUALITY				        23
+ #define PROPCASE_RESOLUTION				        24
+ #define PROPCASE_EV_CORRECTION_1				25
+ #define PROPCASE_EV_CORRECTION_2				26
+ #define PROPCASE_ORIENTATION_SENSOR			37
+ #define PROPCASE_DIGITAL_ZOOM_STATE                            58
+ #define PROPCASE_DIGITAL_ZOOM_POSITION                         57
+ #define PROPCASE_DISPLAY_MODE                         181
+ #define PROPCASE_BRACKET_MODE                         36 //missing for dryos!
+#else
+ #error unknown camera processor
+#endif
+
+
+#define MAX_DIST 65535
+
+//********************
+//char * get_debug();
+//********************
+
+#define MODE_SCREEN_MASK        0x0C00
+#define MODE_SCREEN_OPENED      0x0400
+#define MODE_SCREEN_ROTATED     0x0800
+#define AS_SIZE (sizeof(aperture_sizes_table)/sizeof(aperture_sizes_table[0]))
+#define ASID_MIN (aperture_sizes_table[0].id)
+#define ASID_MAX (aperture_sizes_table[AS_SIZE-1].id)
+
+/* Keyboard repeat and initial delays */
+#define KBD_REPEAT_DELAY  140
+#define KBD_INITIAL_DELAY 300
+
+// Video recording current status constants, see movie_status variable 
+#define VIDEO_RECORD_NEVER_STARTED 0  
+#define VIDEO_RECORD_STOPPED 1  
+#define VIDEO_RECORD_IN_PROGRESS 4
+
+//Optical & digital zoom status constants, see zoom_status variable 
+#define ZOOM_OPTICAL_MIN         1
+#define ZOOM_OPTICAL_MAX         2
+#define ZOOM_OPTICAL_MEDIUM      3
+#define ZOOM_OPTICAL_IN          4
+#define ZOOM_OPTICAL_OUT         5
+#define ZOOM_OPTICAL_REACHED_MIN 7
+
+#define ZOOM_DIGITAL_MAX         9
+#define ZOOM_DIGITAL_MEDIUM      10
+#define ZOOM_DIGITAL_IN          11
+#define ZOOM_DIGITAL_OUT         12
+#define ZOOM_DIGITAL_REACHED_MAX 13
+
+typedef struct {
+    short id; // hacks id
+    short prop_id; // Canons id
+    char name[8];
+    short shutter_dfs_value; // shutter speed to use dark frame substraction
+} ISOTable;
+
+typedef struct {
+    short id; // hacks id
+    short prop_id; // Canons id
+    char name[8];
+    long usec;
+} ShutterSpeed;
+
+typedef struct {
+    short id; // hacks id
+    short prop_id; // Canons id
+    char name[8];
+} ApertureSize;
+
+typedef struct {
+    short av96;
+    short dav96;
+    short av96_step;
+    short tv96;
+    short dtv96;
+    short tv96_step;
+    short sv96;
+    short dsv96;
+    short sv96_step;
+    short iso;
+    short diso;
+    short iso_step;
+    short subj_dist;
+    short dsubj_dist;
+    short subj_dist_step;
+    short shoot_counter;
+    short type;
+} EXPO_BRACKETING_VALUES;
+
+#define SET_NOW      1
+#define SET_LATER    0
+
+#define SHOW_ALWAYS    1
+#define SHOW_HALF      2
+
+
+typedef struct {
+    short av96;
+    short tv96;
+    short sv96;
+    short subj_dist;
+    short nd_filter;
+} PHOTO_PARAM;
+
+typedef struct {
+    int    subject_distance;
+    int     near_limit;
+    int     far_limit;
+    int     hyperfocal_distance;
+    int     depth_of_field;
+    int     lens_to_focal_plane_width;
+} DOF_TYPE;
+
+typedef struct {
+    short av96;
+    short tv96;
+    short sv96;
+    short iso;
+    short sv96_market;
+    short iso_market;
+    short bv96_measured;
+    short bv96_seted;//Ev96_internal-Sv96
+    short ev96_seted; //Tv96+Av96
+    short ev96_measured; //Bv96+Sv96
+    short dev96;// Ev96_external-Ev96_internal
+    short dev96_canon;// Canon OverExposure
+    int b; //average scene luminance 
+} EXPO_TYPE;
+
+typedef struct {
+    float value; 
+    char fraction[10];
+} shutter_speed;
+
+
+/******************************************************************/
+
+int get_focal_length(int zp);
+int get_effective_focal_length(int zp);
+int get_zoom_x(int zp);
+
+/******************************************************************/
+
+long get_tick_count();
+
+void remount_filesystem();
+void mark_filesystem_bootable();
+
+/******************************************************************/
+
+long get_parameter_data(long id, void *buf, long bufsize);
+long set_parameter_data(long id, void *buf, long bufsize);
+
+long get_property_case(long id, void *buf, long bufsize);
+long set_property_case(long id, void *buf, long bufsize);
+
+long get_file_counter();
+long get_exposure_counter();
+long get_file_next_counter();
+long get_target_dir_num();
+long get_target_file_num();
+
+/******************************************************************/
+
+void kbd_key_press(long key);
+void kbd_key_release(long key);
+void kbd_key_release_all();
+long kbd_is_key_pressed(long key);
+long kbd_is_key_clicked(long key);
+long kbd_get_pressed_key();
+long kbd_get_clicked_key();
+long kbd_get_autoclicked_key();
+void kbd_reset_autoclicked_key();
+long kbd_use_zoom_as_mf();
+long kbd_use_up_down_left_right_as_fast_switch();
+void kbd_set_alt_mode_key_mask(long key);
+int get_usb_power(int edge);
+/******************************************************************/
+
+long vid_is_bitmap_shown();
+void *vid_get_bitmap_fb();
+long vid_get_bitmap_screen_width();
+long vid_get_bitmap_screen_height();
+long vid_get_bitmap_buffer_width();
+long vid_get_bitmap_buffer_height();
+void *vid_get_viewport_fb();
+void *vid_get_viewport_fb_d();
+void *vid_get_viewport_live_fb();
+void vid_bitmap_refresh();
+long vid_get_viewport_height();
+
+/******************************************************************/
+
+void *hook_raw_fptr();
+void *hook_raw_ret_addr();
+char *hook_raw_image_addr();
+long hook_raw_size();
+void hook_raw_install();
+void hook_raw_save_complete();
+
+/******************************************************************/
+
+long lens_get_zoom_pos();
+void lens_set_zoom_pos(long newpos);
+long lens_get_zoom_point();
+void lens_set_zoom_point(long newpt);
+void lens_set_zoom_speed(long newspd); //for S-series
+long lens_get_focus_pos();
+long lens_get_focus_pos_from_lense();
+void lens_set_focus_pos(long newpos);
+long lens_get_target_distance();
+
+/******************************************************************/
+
+int shooting_in_progress();
+int shooting_is_flash();
+int shooting_is_flash_ready();
+short shooting_get_flash_mode();
+
+
+/******************************************************************/
+int shooting_get_user_tv_id();
+char* shooting_get_tv_str();
+short shooting_get_tv96_from_shutter_speed(float t);
+short shooting_get_tv96();
+void shooting_set_tv96(short v, short is_now);
+void shooting_set_tv96_direct(short v, short is_now);
+void shooting_set_shutter_speed_ubasic(int t, short is_now);
+short shooting_get_user_tv96();
+void shooting_set_user_tv96(short v);
+float shooting_get_shutter_speed_from_tv96(short tv);
+float shooting_get_shutter_speed_override_value();
+const char * shooting_get_tv_override_value();
+const char * shooting_get_tv_bracket_value();
+const char * shooting_get_bracket_type();
+void shooting_set_user_tv_by_id(int v);
+void shooting_set_user_tv_by_id_rel(int v);
+const ShutterSpeed *shooting_get_tv_line();
+/******************************************************************/
+short shooting_get_aperture_sizes_table_size();
+short shooting_get_aperture_sizes_table_prop_id(short i);
+short shooting_get_max_aperture_sizes_table_prop_id();
+short shooting_get_aperture_from_av96(short av96);
+int shooting_get_user_av_id();
+char* shooting_get_av_str();
+void shooting_set_user_av_by_id(int v);
+short shooting_get_av96();
+void shooting_set_av96(short v,short is_now);
+void shooting_set_av96_direct(short v, short is_now);
+short shooting_get_user_av96();
+void shooting_set_user_av96(short v);
+void shooting_set_user_av_by_id_rel(int v);
+short shooting_get_real_aperture();
+short shooting_get_min_real_aperture();
+short shooting_get_av96_override_value();
+const char * shooting_get_av_bracket_value();
+void shooting_set_nd_filter_state(short v, short is_now);
+/******************************************************************/
+int shooting_get_day_seconds();
+int shooting_get_tick_count();
+/******************************************************************/
+void shooting_set_prop(int id, int v);
+int shooting_get_prop(int id);
+/******************************************************************/
+extern int circle_of_confusion;
+/******************************************************************/
+extern const int zoom_points;
+int shooting_get_zoom();
+void shooting_set_zoom(int v);
+void shooting_set_zoom_rel(int v);
+void shooting_set_zoom_speed(int v);
+/******************************************************************/
+int shooting_get_focus();
+void shooting_set_focus(int v, short is_now);
+short shooting_get_focus_mode();
+int shooting_get_hyperfocal_distance();
+int shooting_get_hyperfocal_distance_f(int av, int fl);
+int shooting_get_near_limit_of_acceptable_sharpness();
+int shooting_get_far_limit_of_acceptable_sharpness();
+int shooting_get_depth_of_field();
+int shooting_get_subject_distance();
+int shooting_get_subject_distance_override_value();
+int shooting_get_subject_distance_bracket_value();
+int shooting_get_subject_distance_override_koef();
+int shooting_get_lens_to_focal_plane_width();
+short shooting_get_drive_mode();
+short shooting_can_focus();
+short shooting_get_common_focus_mode();
+/******************************************************************/
+int shooting_get_iso_mode();
+void shooting_set_iso_mode(int v);
+short shooting_get_sv96();
+short shooting_get_svm96();
+short shooting_get_iso_market();
+short shooting_get_iso_real();
+void shooting_set_iso_real(short iso, short is_now);
+//void shooting_set_iso_market(short isom);
+//void shooting_set_iso_real_delta_from_base(short diso);
+void shooting_set_sv96(short sv96, short is_now);
+short shooting_get_iso_override_value();
+short shooting_get_iso_bracket_value();
+/******************************************************************/
+short shooting_get_canon_overexposure_value();
+short shooting_get_bv96();
+int shooting_get_luminance();
+//const char* shooting_get_flash_light_value();
+/******************************************************************/
+int shooting_get_canon_subject_distance();
+int shooting_get_exif_subject_dist();
+/******************************************************************/
+void shooting_expo_param_override();
+void shooting_bracketing(void);
+
+void shooting_video_bitrate_change(int v);
+extern int auto_started;
+void shooting_tv_bracketing();
+void shooting_av_bracketing();
+void shooting_iso_bracketing();
+/******************************************************************/
+void clear_values();
+/******************************************************************/
+
+
+int mode_get();
+
+/******************************************************************/
+
+long stat_get_vbatt();
+int get_ccd_temp();
+int get_optical_temp();
+int get_battery_temp();
+long get_vbatt_min();
+long get_vbatt_max();
+void play_sound(unsigned sound);
+void ubasic_camera_set_raw(int mode);
+void ubasic_camera_set_nr(int mode);
+int ubasic_camera_get_nr();
+int ubasic_camera_script_autostart();
+void ubasic_camera_set_script_autostart();
+void exit_alt();
+void camera_shutdown_in_a_second(void); 
+
+extern int shot_histogram_enabled;
+
+void disable_shutdown();
+void enable_shutdown();
+
+void JogDial_CW(void);
+void JogDial_CCW(void);
+void change_video_tables(int a, int b);
+int get_flash_params_count(void);
+
+/******************************************************************/
+void __attribute__((noreturn)) shutdown();
+void ubasic_set_led(int led, int state, int bright);
+void debug_led(int state);
+/****************************************/
+extern int canon_menu_active;  
+extern char canon_shoot_menu_active;  
+extern int recreview_hold;
+
+extern int movie_status;
+unsigned int movie_reset;
+unsigned int GetFreeCardSpaceKb(void);
+unsigned int GetTotalCardSpaceKb(void);
+
+
+
+void swap_partitions(void);
+int get_part_count(void);
+void create_partitions(void);
+extern char * camera_jpeg_count_str();
+
+unsigned int GetJpgCount(void);
+unsigned int GetRawCount(void);
+
+void MakeAFScan(void); 
+extern int movie_status; 
+extern int zoom_status;
+void EnterToCompensationEVF(void);
+void ExitFromCompensationEVF(void);
+
+void wait_until_remote_button_is_released(void);
+short shooting_get_ev_correction1();
+
+#define started() debug_led(1)
+#define finished() debug_led(0)
+
+#endif
Index: /trunk/include/stdarg.h
===================================================================
--- /trunk/include/stdarg.h	(revision 511)
+++ /trunk/include/stdarg.h	(revision 511)
@@ -0,0 +1,9 @@
+#ifndef STDARG_H
+#define STDARG_H
+
+#define va_list __builtin_va_list
+#define va_start __builtin_va_start
+#define va_arg __builtin_va_arg
+#define va_end __builtin_va_end
+
+#endif
Index: /trunk/include/errno.h
===================================================================
--- /trunk/include/errno.h	(revision 511)
+++ /trunk/include/errno.h	(revision 511)
@@ -0,0 +1,1 @@
+
Index: /trunk/include/conf.h
===================================================================
--- /trunk/include/conf.h	(revision 511)
+++ /trunk/include/conf.h	(revision 511)
@@ -0,0 +1,300 @@
+#ifndef CONF_H
+#define CONF_H
+
+#include "gui.h"
+#include "script.h"
+
+#define USER_MENU_ITEMS 14
+
+typedef struct {
+    unsigned short  x, y;
+} OSD_pos;
+
+typedef struct {
+    int save_raw;
+    int save_raw_in_video;
+    int save_raw_in_sports;
+    int save_raw_in_burst;
+    int save_raw_in_ev_bracketing;
+    int save_raw_in_timer;
+    int raw_exceptions_warn;
+    int raw_in_dir;
+    int raw_prefix;
+    int raw_ext;
+    int raw_save_first_only; //for series shooting
+    int raw_nr;
+    int sub_batch_prefix; // output of batch subtracts
+    int sub_batch_ext;
+    int sub_in_dark_value; // values <= to this are not subtracted, i.e. the dark value of your darkframe
+    int sub_out_dark_value; // minimum value to output from subtract, i.e. dark value of your final image
+
+    int show_osd;
+    int hide_osd;
+    int show_osd_in_review;
+    int script_shoot_delay;
+    int show_histo;
+    int ubasic_vars[SCRIPT_NUM_PARAMS];
+    char script_file[100];
+
+    int show_dof;
+    int batt_volts_max;
+    int batt_volts_min;
+    int batt_step_25;
+    int batt_perc_show;
+    int batt_volts_show;
+    int batt_icon_show;
+    int space_bar_show;
+    int space_bar_size;
+    int space_bar_width;
+    int space_icon_show;
+    int show_clock;
+    int show_temp;
+    int clock_format;
+    int clock_indicator;
+    int clock_halfpress;
+    int space_perc_show;
+    int space_mb_show;
+    int space_perc_warn;
+    int space_mb_warn;
+    int space_warn_type;
+    int show_movie_time;
+    int show_movie_refresh;
+
+
+    int zoom_value;
+
+    int show_state;
+    int show_remaining_raw;
+    int remaining_raw_treshold;
+    int show_raw_state;
+    int show_values;
+    int show_values_in_video;
+    int show_overexp;
+
+    int histo_mode;
+    int histo_auto_ajust;
+    int histo_ignore_boundary;
+    int histo_layout;
+    int histo_show_ev_grid;
+
+    int zebra_draw;
+    int zebra_mode;
+    int zebra_restore_screen;
+    int zebra_restore_osd;
+    int zebra_over;
+    int zebra_under;
+    int zebra_draw_osd;
+    int zebra_multichannel;
+
+    OSD_pos histo_pos;
+    OSD_pos dof_pos;
+    OSD_pos batt_icon_pos;
+    OSD_pos space_icon_pos;
+    OSD_pos space_hor_pos;
+    OSD_pos space_ver_pos;
+    OSD_pos batt_txt_pos;
+    OSD_pos space_txt_pos;
+    OSD_pos mode_state_pos;
+    OSD_pos mode_raw_pos;
+    OSD_pos values_pos;
+    OSD_pos clock_pos;
+    OSD_pos mode_video_pos;
+    OSD_pos mode_ev_pos;
+    OSD_pos temp_pos;
+
+    color histo_color;
+    color histo_color2; // markers/border
+    color osd_color;
+    color osd_color_warn;
+    color batt_icon_color;
+    color space_color;
+    color menu_color;
+    color menu_title_color;
+    color menu_cursor_color;
+    color menu_symbol_color;
+    int menu_center;
+    int menu_select_first_entry;
+    int menu_symbol_enable;
+    color reader_color;
+    color zebra_color; // under/over
+    color grid_color;
+    color osd_color_override;
+
+    int font_cp;
+    char menu_rbf_file[100];
+    char menu_symbol_rbf_file[100];
+
+    char lang_file[100];
+
+    char reader_file[100];
+    int  reader_pos;
+    int  reader_autoscroll;
+    int  reader_autoscroll_delay;
+    char reader_rbf_file[100];
+    int  reader_codepage;
+    int  reader_wrap_by_words;
+
+    int sokoban_level;
+
+    int flashlight;
+    int fast_ev;
+    int fast_ev_step;
+    int fast_movie_control;
+    int fast_movie_quality_control;
+    int splash_show;
+    int start_sound;
+
+    int use_zoom_mf;
+    long alt_mode_button; //for S-series
+    int alt_prevent_shutdown;
+
+    int show_grid_lines;
+    char grid_lines_file[100];
+    int grid_force_color;
+
+    int video_mode;
+    int video_quality;
+    int video_bitrate;
+      
+    int tv_bracket_value;
+    int av_bracket_value;
+    int iso_bracket_value;
+    int iso_bracket_koef;
+    int subj_dist_bracket_value;
+    int subj_dist_bracket_koef;
+    int bracket_type;
+    int clear_bracket;
+    int clear_video;
+    int override_disable;
+    int override_disable_all;
+
+
+    int tv_override_value;
+    int tv_override_koef;
+    int tv_enum_type;
+    int av_override_value;
+    
+    int nd_filter_state;
+    
+    int iso_override_value;
+    int iso_override_koef;
+    int subj_dist_override_value;
+    int subj_dist_override_koef;
+    int clear_override;
+    
+    int autoiso_enable;
+    int autoiso_shutter;
+    int autoiso_user_factor;
+    int autoiso_is_factor;
+    int autoiso_max_iso_hi;
+    int autoiso_max_iso_auto;
+    int autoiso_min_iso;
+
+    int recalc_exposure;
+    int tv_exposure_order;
+    int av_exposure_order;
+    int iso_exposure_order;
+
+    int dof_subj_dist_as_near_limit;
+    int dof_use_exif_subj_dist;
+    int dof_subj_dist_in_misc;
+    int dof_near_limit_in_misc;
+    int dof_far_limit_in_misc;
+    int dof_hyperfocal_in_misc;
+    int dof_depth_in_misc;
+    int dof_dist_from_lens;
+    
+    
+    int values_show_in_review;
+    int values_show_zoom;
+    int values_show_real_aperture;		
+    int values_show_real_iso;
+    int values_show_market_iso;
+    int values_show_iso_only_in_autoiso_mode;
+    int values_show_ev_seted;
+    int values_show_ev_measured;
+    int values_show_bv_measured;
+    int values_show_bv_seted;
+    int values_show_overexposure;
+    int values_show_canon_overexposure;
+    int values_show_luminance;
+
+    int debug_shortcut_action;  // 0=none, 1=dump, 2=page display
+    int debug_display;          // 0=none, 1=props, 2=flash param, 3=tasks
+
+    int script_startup;			// remote autostart
+    int remote_enable;			// remote enable
+    int user_menu_enable;
+    int user_menu_vars[USER_MENU_ITEMS];
+    int user_menu_as_root;
+    int zoom_scale;
+    int unlock_optical_zoom_for_video;
+    int mute_on_zoom;
+    int bad_pixel_removal;
+    int video_af_key;
+    
+    char curve_file[100];
+    int curve_enable;
+    
+    int edge_overlay_enable;
+    int edge_overlay_thresh;
+    color edge_overlay_color;
+
+    int synch_enable;
+    int ricoh_ca1_mode;
+    int synch_delay_enable;
+    int synch_delay_value;
+    int synch_delay_coarse_value;
+    int remote_zoom_enable;
+    int zoom_timeout;
+
+    int script_param_set;
+    int script_param_save;
+    
+    long mem_view_addr_init;
+} Conf;
+
+extern Conf conf;
+
+#define ALT_PREVENT_SHUTDOWN_NO         0
+#define ALT_PREVENT_SHUTDOWN_ALT        1
+#define ALT_PREVENT_SHUTDOWN_ALT_SCRIPT 2
+
+#define SHOOTING_PROGRESS_NONE          0
+#define SHOOTING_PROGRESS_STARTED       1
+#define SHOOTING_PROGRESS_PROCESSING    2
+#define SHOOTING_PROGRESS_DONE          3
+
+// video quality defaults. Ideally, these should match the camera default settings
+#define VIDEO_DEFAULT_QUALITY   84  // ? where does 84 come from
+#define VIDEO_MAX_QUALITY       99
+#define VIDEO_DEFAULT_BITRATE   3 // should be 1 for all cams
+
+extern int state_kbd_script_run;
+extern int state_shooting_progress;
+extern int state_save_raw_nth_only;
+extern int state_expos_recalculated;
+extern int state_expos_under;
+extern int state_expos_over;
+
+extern int state_debug1;
+extern int debug_propcase_show;
+extern int debug_propcase_page;
+extern int debug_vals_show;
+extern int debug_pardata_show;
+extern void script_autostart();				// remote autostart
+extern void conf_save();
+extern void conf_restore();
+extern void conf_load_defaults();
+extern int shutter_int;
+
+// reyalp: putting these in conf, since the conf values are lookups for them
+// prefixes and extentions available for raw images (index with conf.raw_prefix etc)
+#define NUM_IMG_PREFIXES 3 // IMG_ CRW_ SND_ (could add ETC_ SDR_ AUT_ MVI_ MRK_)
+#define NUM_IMG_EXTS 5 // .JPG .CRW .CR2 .THM .WAV (could add .AVI .MRK)
+extern const char* img_prefixes[NUM_IMG_PREFIXES];
+extern const char* img_exts[NUM_IMG_EXTS];
+// ugh, but various things need it
+#define VIDEO_BITRATE_STEPS 10
+extern const char *video_bitrate_strings[VIDEO_BITRATE_STEPS];
+#endif
Index: /trunk/include/luaconf.h
===================================================================
--- /trunk/include/luaconf.h	(revision 511)
+++ /trunk/include/luaconf.h	(revision 511)
@@ -0,0 +1,772 @@
+/*
+** $Id: luaconf.h,v 1.82.1.6 2008/01/18 17:07:48 roberto Exp $
+** Configuration file for Lua
+** See Copyright Notice in lua.h
+*/
+
+
+#ifndef lconfig_h
+#define lconfig_h
+
+#include <limits.h>
+#include <stddef.h>
+
+/*
+** ==================================================================
+** Search for "@@" to find all configurable definitions.
+** ===================================================================
+*/
+
+
+/*
+@@ LUA_ANSI controls the use of non-ansi features.
+** CHANGE it (define it) if you want Lua to avoid the use of any
+** non-ansi feature or library.
+*/
+#if defined(__STRICT_ANSI__)
+#define LUA_ANSI
+#endif
+
+
+#if !defined(LUA_ANSI) && defined(_WIN32)
+#define LUA_WIN
+#endif
+
+#if defined(LUA_USE_LINUX)
+#define LUA_USE_POSIX
+#define LUA_USE_DLOPEN		/* needs an extra library: -ldl */
+#define LUA_USE_READLINE	/* needs some extra libraries */
+#endif
+
+#if defined(LUA_USE_MACOSX)
+#define LUA_USE_POSIX
+#define LUA_DL_DYLD		/* does not need extra library */
+#endif
+
+
+
+/*
+@@ LUA_USE_POSIX includes all functionallity listed as X/Open System
+@* Interfaces Extension (XSI).
+** CHANGE it (define it) if your system is XSI compatible.
+*/
+#if defined(LUA_USE_POSIX)
+#define LUA_USE_MKSTEMP
+#define LUA_USE_ISATTY
+#define LUA_USE_POPEN
+#define LUA_USE_ULONGJMP
+#endif
+
+
+/*
+@@ LUA_PATH and LUA_CPATH are the names of the environment variables that
+@* Lua check to set its paths.
+@@ LUA_INIT is the name of the environment variable that Lua
+@* checks for initialization code.
+** CHANGE them if you want different names.
+*/
+#define LUA_PATH        "LUA_PATH"
+#define LUA_CPATH       "LUA_CPATH"
+#define LUA_INIT	"LUA_INIT"
+
+
+/*
+@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
+@* Lua libraries.
+@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for
+@* C libraries.
+** CHANGE them if your machine has a non-conventional directory
+** hierarchy or if you want to install your libraries in
+** non-conventional directories.
+*/
+#if defined(_WIN32)
+/*
+** In Windows, any exclamation mark ('!') in the path is replaced by the
+** path of the directory of the executable file of the current process.
+*/
+#define LUA_LDIR	"!\\lua\\"
+#define LUA_CDIR	"!\\"
+#define LUA_PATH_DEFAULT  \
+		".\\?.lua;"  LUA_LDIR"?.lua;"  LUA_LDIR"?\\init.lua;" \
+		             LUA_CDIR"?.lua;"  LUA_CDIR"?\\init.lua"
+#define LUA_CPATH_DEFAULT \
+	".\\?.dll;"  LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
+
+#else
+#define LUA_ROOT	"/usr/local/"
+#define LUA_LDIR	LUA_ROOT "share/lua/5.1/"
+#define LUA_CDIR	LUA_ROOT "lib/lua/5.1/"
+#define LUA_PATH_DEFAULT  \
+		"./?.lua;"  LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
+		            LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua"
+#define LUA_CPATH_DEFAULT \
+	"./?.so;"  LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
+#endif
+
+
+/*
+@@ LUA_DIRSEP is the directory separator (for submodules).
+** CHANGE it if your machine does not use "/" as the directory separator
+** and is not Windows. (On Windows Lua automatically uses "\".)
+*/
+#if defined(_WIN32)
+#define LUA_DIRSEP	"\\"
+#else
+#define LUA_DIRSEP	"/"
+#endif
+
+
+/*
+@@ LUA_PATHSEP is the character that separates templates in a path.
+@@ LUA_PATH_MARK is the string that marks the substitution points in a
+@* template.
+@@ LUA_EXECDIR in a Windows path is replaced by the executable's
+@* directory.
+@@ LUA_IGMARK is a mark to ignore all before it when bulding the
+@* luaopen_ function name.
+** CHANGE them if for some reason your system cannot use those
+** characters. (E.g., if one of those characters is a common character
+** in file/directory names.) Probably you do not need to change them.
+*/
+#define LUA_PATHSEP	";"
+#define LUA_PATH_MARK	"?"
+#define LUA_EXECDIR	"!"
+#define LUA_IGMARK	"-"
+
+
+/*
+@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger.
+** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
+** machines, ptrdiff_t gives a good choice between int or long.)
+*/
+#define LUA_INTEGER	int
+
+
+/*
+@@ LUA_API is a mark for all core API functions.
+@@ LUALIB_API is a mark for all standard library functions.
+** CHANGE them if you need to define those functions in some special way.
+** For instance, if you want to create one Windows DLL with the core and
+** the libraries, you may want to use the following definition (define
+** LUA_BUILD_AS_DLL to get it).
+*/
+#if defined(LUA_BUILD_AS_DLL)
+
+#if defined(LUA_CORE) || defined(LUA_LIB)
+#define LUA_API __declspec(dllexport)
+#else
+#define LUA_API __declspec(dllimport)
+#endif
+
+#else
+
+#define LUA_API		extern
+
+#endif
+
+/* more often than not the libs go together with the core */
+#define LUALIB_API	LUA_API
+
+
+/*
+@@ LUAI_FUNC is a mark for all extern functions that are not to be
+@* exported to outside modules.
+@@ LUAI_DATA is a mark for all extern (const) variables that are not to
+@* be exported to outside modules.
+** CHANGE them if you need to mark them in some special way. Elf/gcc
+** (versions 3.2 and later) mark them as "hidden" to optimize access
+** when Lua is compiled as a shared library.
+*/
+#if defined(luaall_c)
+#define LUAI_FUNC	static
+#define LUAI_DATA	/* empty */
+
+#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
+      defined(__ELF__)
+/* reyalp: hidden is irrelevant if not dynamically linked*/
+#if defined(HDK_VERSION)
+#define LUAI_FUNC	extern
+#else
+#define LUAI_FUNC	__attribute__((visibility("hidden"))) extern
+#endif
+#define LUAI_DATA	LUAI_FUNC
+
+#else
+#define LUAI_FUNC	extern
+#define LUAI_DATA	extern
+#endif
+
+
+
+/*
+@@ LUA_QL describes how error messages quote program elements.
+** CHANGE it if you want a different appearance.
+*/
+#define LUA_QL(x)	"'" x "'"
+#define LUA_QS		LUA_QL("%s")
+
+
+/*
+@@ LUA_IDSIZE gives the maximum size for the description of the source
+@* of a function in debug information.
+** CHANGE it if you want a different size.
+*/
+#define LUA_IDSIZE	60
+
+
+/*
+** {==================================================================
+** Stand-alone configuration
+** ===================================================================
+*/
+
+#if defined(lua_c) || defined(luaall_c)
+
+/*
+@@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that
+@* is, whether we're running lua interactively).
+** CHANGE it if you have a better definition for non-POSIX/non-Windows
+** systems.
+*/
+#if defined(LUA_USE_ISATTY)
+#include <unistd.h>
+#define lua_stdin_is_tty()	isatty(0)
+#elif defined(LUA_WIN)
+#include <io.h>
+#include <stdio.h>
+#define lua_stdin_is_tty()	_isatty(_fileno(stdin))
+#else
+#define lua_stdin_is_tty()	1  /* assume stdin is a tty */
+#endif
+
+
+/*
+@@ LUA_PROMPT is the default prompt used by stand-alone Lua.
+@@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua.
+** CHANGE them if you want different prompts. (You can also change the
+** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.)
+*/
+#define LUA_PROMPT		"> "
+#define LUA_PROMPT2		">> "
+
+
+/*
+@@ LUA_PROGNAME is the default name for the stand-alone Lua program.
+** CHANGE it if your stand-alone interpreter has a different name and
+** your system is not able to detect that name automatically.
+*/
+#define LUA_PROGNAME		"lua"
+
+
+/*
+@@ LUA_MAXINPUT is the maximum length for an input line in the
+@* stand-alone interpreter.
+** CHANGE it if you need longer lines.
+*/
+#define LUA_MAXINPUT	512
+
+
+/*
+@@ lua_readline defines how to show a prompt and then read a line from
+@* the standard input.
+@@ lua_saveline defines how to "save" a read line in a "history".
+@@ lua_freeline defines how to free a line read by lua_readline.
+** CHANGE them if you want to improve this functionality (e.g., by using
+** GNU readline and history facilities).
+*/
+#if defined(LUA_USE_READLINE)
+#include <stdio.h>
+#include <readline/readline.h>
+#include <readline/history.h>
+#define lua_readline(L,b,p)	((void)L, ((b)=readline(p)) != NULL)
+#define lua_saveline(L,idx) \
+	if (lua_strlen(L,idx) > 0)  /* non-empty line? */ \
+	  add_history(lua_tostring(L, idx));  /* add it to history */
+#define lua_freeline(L,b)	((void)L, free(b))
+#else
+#define lua_readline(L,b,p)	\
+	((void)L, fputs(p, stdout), fflush(stdout),  /* show prompt */ \
+	fgets(b, LUA_MAXINPUT, stdin) != NULL)  /* get line */
+#define lua_saveline(L,idx)	{ (void)L; (void)idx; }
+#define lua_freeline(L,b)	{ (void)L; (void)b; }
+#endif
+
+#endif
+
+/* }================================================================== */
+
+
+/*
+@@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles
+@* as a percentage.
+** CHANGE it if you want the GC to run faster or slower (higher values
+** mean larger pauses which mean slower collection.) You can also change
+** this value dynamically.
+*/
+#define LUAI_GCPAUSE	200  /* 200% (wait memory to double before next GC) */
+
+
+/*
+@@ LUAI_GCMUL defines the default speed of garbage collection relative to
+@* memory allocation as a percentage.
+** CHANGE it if you want to change the granularity of the garbage
+** collection. (Higher values mean coarser collections. 0 represents
+** infinity, where each step performs a full collection.) You can also
+** change this value dynamically.
+*/
+#define LUAI_GCMUL	200 /* GC runs 'twice the speed' of memory allocation */
+
+
+
+/*
+@@ LUA_COMPAT_GETN controls compatibility with old getn behavior.
+** CHANGE it (define it) if you want exact compatibility with the
+** behavior of setn/getn in Lua 5.0.
+*/
+#undef LUA_COMPAT_GETN
+
+/*
+@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib.
+** CHANGE it to undefined as soon as you do not need a global 'loadlib'
+** function (the function is still available as 'package.loadlib').
+*/
+#undef LUA_COMPAT_LOADLIB
+
+/*
+@@ LUA_COMPAT_VARARG controls compatibility with old vararg feature.
+** CHANGE it to undefined as soon as your programs use only '...' to
+** access vararg parameters (instead of the old 'arg' table).
+*/
+#undef LUA_COMPAT_VARARG
+
+/*
+@@ LUA_COMPAT_MOD controls compatibility with old math.mod function.
+** CHANGE it to undefined as soon as your programs use 'math.fmod' or
+** the new '%' operator instead of 'math.mod'.
+*/
+#undef LUA_COMPAT_MOD
+
+/*
+@@ LUA_COMPAT_LSTR controls compatibility with old long string nesting
+@* facility.
+** CHANGE it to 2 if you want the old behaviour, or undefine it to turn
+** off the advisory error when nesting [[...]].
+*/
+#undef LUA_COMPAT_LSTR
+
+/*
+@@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name.
+** CHANGE it to undefined as soon as you rename 'string.gfind' to
+** 'string.gmatch'.
+*/
+#undef LUA_COMPAT_GFIND
+
+/*
+@@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib'
+@* behavior.
+** CHANGE it to undefined as soon as you replace to 'luaL_register'
+** your uses of 'luaL_openlib'
+*/
+#undef LUA_COMPAT_OPENLIB
+
+
+
+/*
+@@ luai_apicheck is the assert macro used by the Lua-C API.
+** CHANGE luai_apicheck if you want Lua to perform some checks in the
+** parameters it gets from API calls. This may slow down the interpreter
+** a bit, but may be quite useful when debugging C code that interfaces
+** with Lua. A useful redefinition is to use assert.h.
+*/
+#if defined(LUA_USE_APICHECK)
+#include <assert.h>
+#define luai_apicheck(L,o)	{ (void)L; assert(o); }
+#else
+#define luai_apicheck(L,o)	{ (void)L; }
+#endif
+
+
+/*
+@@ LUAI_BITSINT defines the number of bits in an int.
+** CHANGE here if Lua cannot automatically detect the number of bits of
+** your machine. Probably you do not need to change this.
+*/
+/* avoid overflows in comparison */
+#if INT_MAX-20 < 32760
+#define LUAI_BITSINT	16
+#elif INT_MAX > 2147483640L
+/* int has at least 32 bits */
+#define LUAI_BITSINT	32
+#else
+#error "you must define LUA_BITSINT with number of bits in an integer"
+#endif
+
+
+/*
+@@ LUAI_UINT32 is an unsigned integer with at least 32 bits.
+@@ LUAI_INT32 is an signed integer with at least 32 bits.
+@@ LUAI_UMEM is an unsigned integer big enough to count the total
+@* memory used by Lua.
+@@ LUAI_MEM is a signed integer big enough to count the total memory
+@* used by Lua.
+** CHANGE here if for some weird reason the default definitions are not
+** good enough for your machine. (The definitions in the 'else'
+** part always works, but may waste space on machines with 64-bit
+** longs.) Probably you do not need to change this.
+*/
+#if LUAI_BITSINT >= 32
+#define LUAI_UINT32	unsigned int
+#define LUAI_INT32	int
+#define LUAI_MAXINT32	INT_MAX
+#define LUAI_UMEM	size_t
+#define LUAI_MEM	ptrdiff_t
+#else
+/* 16-bit ints */
+#define LUAI_UINT32	unsigned long
+#define LUAI_INT32	long
+#define LUAI_MAXINT32	LONG_MAX
+#define LUAI_UMEM	unsigned long
+#define LUAI_MEM	long
+#endif
+
+
+/*
+@@ LUAI_MAXCALLS limits the number of nested calls.
+** CHANGE it if you need really deep recursive calls. This limit is
+** arbitrary; its only purpose is to stop infinite recursion before
+** exhausting memory.
+*/
+#define LUAI_MAXCALLS	20000
+
+
+/*
+@@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function
+@* can use.
+** CHANGE it if you need lots of (Lua) stack space for your C
+** functions. This limit is arbitrary; its only purpose is to stop C
+** functions to consume unlimited stack space.
+*/
+#define LUAI_MCS_AUX	((int)(INT_MAX / (4*sizeof(LUA_NUMBER))))
+#define LUAI_MAXCSTACK	(LUAI_MCS_AUX > SHRT_MAX ? SHRT_MAX : LUAI_MCS_AUX)
+
+
+
+/*
+** {==================================================================
+** CHANGE (to smaller values) the following definitions if your system
+** has a small C stack. (Or you may want to change them to larger
+** values if your system has a large C stack and these limits are
+** too rigid for you.) Some of these constants control the size of
+** stack-allocated arrays used by the compiler or the interpreter, while
+** others limit the maximum number of recursive calls that the compiler
+** or the interpreter can perform. Values too large may cause a C stack
+** overflow for some forms of deep constructs.
+** ===================================================================
+*/
+
+
+/*
+@@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and
+@* syntactical nested non-terminals in a program.
+*/
+#define LUAI_MAXCCALLS		200
+
+
+/*
+@@ LUAI_MAXVARS is the maximum number of local variables per function
+@* (must be smaller than 250).
+*/
+#define LUAI_MAXVARS		200
+
+
+/*
+@@ LUAI_MAXUPVALUES is the maximum number of upvalues per function
+@* (must be smaller than 250).
+*/
+#define LUAI_MAXUPVALUES	60
+
+
+/*
+@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
+*/
+#define LUAL_BUFFERSIZE		512 /*BUFSIZ*/
+
+/* }================================================================== */
+
+
+
+
+/*
+** {==================================================================
+@@ LUA_NUMBER is the type of numbers in Lua.
+** CHANGE the following definitions only if you want to build Lua
+** with a number type different from double. You may also need to
+** change lua_number2int & lua_number2integer.
+** ===================================================================
+*/
+
+//#define LUA_NUMBER_DOUBLE
+#define LUA_NUMBER	int
+
+/*
+@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
+@* over a number.
+*/
+#define LUAI_UACNUMBER	int
+
+
+/*
+@@ LUA_NUMBER_SCAN is the format for reading numbers.
+@@ LUA_NUMBER_FMT is the format for writing numbers.
+@@ lua_number2str converts a number to a string.
+@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion.
+@@ lua_str2number converts a string to a number.
+*/
+#define LUA_NUMBER_SCAN		"%d"
+#define LUA_NUMBER_FMT		"%d"
+#define lua_number2str(s,n)	sprintf((s), LUA_NUMBER_FMT, (n))
+#define LUAI_MAXNUMBER2STR	15
+#define lua_str2number(s,p)	strtol((s), (p), 10)
+
+
+/*
+@@ The luai_num* macros define the primitive operations over numbers.
+*/
+#if defined(LUA_CORE)
+//#include <math.h>
+#define luai_numadd(a,b)	((a)+(b))
+#define luai_numsub(a,b)	((a)-(b))
+#define luai_nummul(a,b)	((a)*(b))
+#define luai_numdiv(a,b)	((a)/(b))
+#define luai_nummod(a,b)	((a)%(b))
+#define luai_numpow(a,b)	(luai_ipow(a,b))
+#define luai_numunm(a)		(-(a))
+#define luai_numeq(a,b)		((a)==(b))
+#define luai_numlt(a,b)		((a)<(b))
+#define luai_numle(a,b)		((a)<=(b))
+#define luai_numisnan(a)	(!luai_numeq((a), (a)))
+#endif
+
+// reyalp - used in lib too
+#if defined(LUA_CORE) || defined(LUA_LIB)
+LUA_NUMBER luai_ipow(LUA_NUMBER, LUA_NUMBER);
+#endif
+
+/*
+@@ lua_number2int is a macro to convert lua_Number to int.
+@@ lua_number2integer is a macro to convert lua_Number to lua_Integer.
+** CHANGE them if you know a faster way to convert a lua_Number to
+** int (with any rounding method and without throwing errors) in your
+** system. In Pentium machines, a naive typecast from double to int
+** in C is extremely slow, so any alternative is worth trying.
+*/
+
+/* On a Pentium, resort to a trick */
+#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \
+    (defined(__i386) || defined (_M_IX86) || defined(__i386__))
+
+/* On a Microsoft compiler, use assembler */
+#if defined(_MSC_VER)
+
+#define lua_number2int(i,d)   __asm fld d   __asm fistp i
+#define lua_number2integer(i,n)		lua_number2int(i, n)
+
+/* the next trick should work on any Pentium, but sometimes clashes
+   with a DirectX idiosyncrasy */
+#else
+
+union luai_Cast { double l_d; long l_l; };
+#define lua_number2int(i,d) \
+  { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; }
+#define lua_number2integer(i,n)		lua_number2int(i, n)
+
+#endif
+
+
+/* this option always works, but may be slow */
+#else
+#define lua_number2int(i,d)	((i)=(int)(d))
+#define lua_number2integer(i,d)	((i)=(lua_Integer)(d))
+
+#endif
+
+/* }================================================================== */
+
+
+/*
+@@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment.
+** CHANGE it if your system requires alignments larger than double. (For
+** instance, if your system supports long doubles and they must be
+** aligned in 16-byte boundaries, then you should add long double in the
+** union.) Probably you do not need to change this.
+*/
+#define LUAI_USER_ALIGNMENT_T	union { double u; void *s; long l; }
+
+
+/*
+@@ LUAI_THROW/LUAI_TRY define how Lua does exception handling.
+** CHANGE them if you prefer to use longjmp/setjmp even with C++
+** or if want/don't to use _longjmp/_setjmp instead of regular
+** longjmp/setjmp. By default, Lua handles errors with exceptions when
+** compiling as C++ code, with _longjmp/_setjmp when asked to use them,
+** and with longjmp/setjmp otherwise.
+*/
+#if defined(__cplusplus)
+/* C++ exceptions */
+#define LUAI_THROW(L,c)	throw(c)
+#define LUAI_TRY(L,c,a)	try { a } catch(...) \
+	{ if ((c)->status == 0) (c)->status = -1; }
+#define luai_jmpbuf	int  /* dummy variable */
+
+#elif defined(LUA_USE_ULONGJMP)
+/* in Unix, try _longjmp/_setjmp (more efficient) */
+#define LUAI_THROW(L,c)	_longjmp((c)->b, 1)
+#define LUAI_TRY(L,c,a)	if (_setjmp((c)->b) == 0) { a }
+#define luai_jmpbuf	jmp_buf
+
+#else
+/* default handling with long jumps */
+#define LUAI_THROW(L,c)	longjmp((c)->b, 1)
+#define LUAI_TRY(L,c,a)	if (setjmp((c)->b) == 0) { a }
+#define luai_jmpbuf	jmp_buf
+
+#endif
+
+
+/*
+@@ LUA_MAXCAPTURES is the maximum number of captures that a pattern
+@* can do during pattern-matching.
+** CHANGE it if you need more captures. This limit is arbitrary.
+*/
+#define LUA_MAXCAPTURES		32
+
+
+/*
+@@ lua_tmpnam is the function that the OS library uses to create a
+@* temporary name.
+@@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam.
+** CHANGE them if you have an alternative to tmpnam (which is considered
+** insecure) or if you want the original tmpnam anyway.  By default, Lua
+** uses tmpnam except when POSIX is available, where it uses mkstemp.
+*/
+#if defined(loslib_c) || defined(luaall_c)
+
+#if defined(LUA_USE_MKSTEMP)
+#include <unistd.h>
+#define LUA_TMPNAMBUFSIZE	32
+#define lua_tmpnam(b,e)	{ \
+	strcpy(b, "/tmp/lua_XXXXXX"); \
+	e = mkstemp(b); \
+	if (e != -1) close(e); \
+	e = (e == -1); }
+
+#else
+#define LUA_TMPNAMBUFSIZE	L_tmpnam
+#define lua_tmpnam(b,e)		{ e = (tmpnam(b) == NULL); }
+#endif
+
+#endif
+
+
+/*
+@@ lua_popen spawns a new process connected to the current one through
+@* the file streams.
+** CHANGE it if you have a way to implement it in your system.
+*/
+#if defined(LUA_USE_POPEN)
+
+#define lua_popen(L,c,m)	((void)L, fflush(NULL), popen(c,m))
+#define lua_pclose(L,file)	((void)L, (pclose(file) != -1))
+
+#elif defined(LUA_WIN)
+
+#define lua_popen(L,c,m)	((void)L, _popen(c,m))
+#define lua_pclose(L,file)	((void)L, (_pclose(file) != -1))
+
+#else
+
+#define lua_popen(L,c,m)	((void)((void)c, m),  \
+		luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0)
+#define lua_pclose(L,file)		((void)((void)L, file), 0)
+
+#endif
+
+/*
+@@ LUA_DL_* define which dynamic-library system Lua should use.
+** CHANGE here if Lua has problems choosing the appropriate
+** dynamic-library system for your platform (either Windows' DLL, Mac's
+** dyld, or Unix's dlopen). If your system is some kind of Unix, there
+** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for
+** it.  To use dlopen you also need to adapt the src/Makefile (probably
+** adding -ldl to the linker options), so Lua does not select it
+** automatically.  (When you change the makefile to add -ldl, you must
+** also add -DLUA_USE_DLOPEN.)
+** If you do not want any kind of dynamic library, undefine all these
+** options.
+** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD.
+*/
+#if defined(LUA_USE_DLOPEN)
+#define LUA_DL_DLOPEN
+#endif
+
+#if defined(LUA_WIN)
+#define LUA_DL_DLL
+#endif
+
+
+/*
+@@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State
+@* (the data goes just *before* the lua_State pointer).
+** CHANGE (define) this if you really need that. This value must be
+** a multiple of the maximum alignment required for your machine.
+*/
+#define LUAI_EXTRASPACE		0
+
+
+/*
+@@ luai_userstate* allow user-specific actions on threads.
+** CHANGE them if you defined LUAI_EXTRASPACE and need to do something
+** extra when a thread is created/deleted/resumed/yielded.
+*/
+#define luai_userstateopen(L)		((void)L)
+#define luai_userstateclose(L)		((void)L)
+#define luai_userstatethread(L,L1)	((void)L)
+#define luai_userstatefree(L)		((void)L)
+#define luai_userstateresume(L,n)	((void)L)
+#define luai_userstateyield(L,n)	((void)L)
+
+
+/*
+@@ LUA_INTFRMLEN is the length modifier for integer conversions
+@* in 'string.format'.
+@@ LUA_INTFRM_T is the integer type correspoding to the previous length
+@* modifier.
+** CHANGE them if your system supports long long or does not support long.
+*/
+
+#if defined(LUA_USELONGLONG)
+
+#define LUA_INTFRMLEN		"ll"
+#define LUA_INTFRM_T		long long
+
+#else
+
+#define LUA_INTFRMLEN		"l"
+#define LUA_INTFRM_T		long
+
+#endif
+
+
+
+/* =================================================================== */
+
+/*
+** Local configuration. You can use this space to add your redefinitions
+** without modifying the main part of the file.
+*/
+
+
+
+#endif
+
+
Index: /trunk/include/core.h
===================================================================
--- /trunk/include/core.h	(revision 511)
+++ /trunk/include/core.h	(revision 511)
@@ -0,0 +1,23 @@
+#ifndef CORE_H
+#define CORE_H
+
+void core_spytask();
+
+void core_hook_task_create(void *tcb);
+void core_hook_task_delete(void *tcb);
+
+long kbd_process();
+
+void gui_init();
+
+void core_rawdata_available();
+void core_spytask_can_start();
+
+#define NOISE_REDUCTION_AUTO_CANON      (0)
+#define NOISE_REDUCTION_OFF             (1)
+#define NOISE_REDUCTION_ON              (2)
+
+long core_get_noise_reduction_value();
+
+#endif
+
Index: /trunk/include/camera.h
===================================================================
--- /trunk/include/camera.h	(revision 511)
+++ /trunk/include/camera.h	(revision 511)
@@ -0,0 +1,628 @@
+#ifndef CAMERA_H
+#define CAMERA_H
+
+//==========================================================
+// Camera-dependent settings
+//==========================================================
+
+//----------------------------------------------------------
+// Default values
+//----------------------------------------------------------
+    #undef  CAM_RAW_ROWPIX                  // Number of pixels in RAW row
+    #undef  CAM_RAW_ROWS                    // Number of rows in RAW
+    
+    #undef  CAM_DRYOS                       // Camera is DryOS-based
+    #undef  CAM_PROPSET                     // Camera's properties group (the generation)
+    
+    #undef  CAM_SWIVEL_SCREEN               // Camera has rotated LCD screen
+    #define CAM_USE_ZOOM_FOR_MF         1   // Zoom lever can be used for manual focus adjustments
+    #undef  CAM_ADJUSTABLE_ALT_BUTTON       // ALT-button can be set from menu
+    #define CAM_REMOTE                  1   // Camera supports USB-remote
+    #define CAM_SYNCH                   1   // Camera supports SDM precision synch
+    #undef  CAM_MULTIPART                   // Camera supports SD-card multipartitioning 
+    #define CAM_HAS_ZOOM_LEVER          1   // Camera has dedicated zoom buttons
+    #undef  CAM_DRAW_EXPOSITION             // Output expo-pair on screen (for cameras which (sometimes) don't do that)
+    #define CAM_HAS_ERASE_BUTTON        1   // Camera has dedicated erase button
+    #define CAM_HAS_IRIS_DIAPHRAGM      1   // Camera has real diaphragm mechanism
+    #undef  CAM_HAS_ND_FILTER               // Camera has build-in ND filter
+    #define CAM_CAN_SD_OVER_NOT_IN_MF   1   // Camera allows subject distance (focus) override when not in manual focus mode
+    #define CAM_CAN_SD_OVERRIDE         1   // Camera allows to do subject distance override
+    #define CAM_HAS_MANUAL_FOCUS        1   // Camera has manual focus mode
+    #define CAM_HAS_USER_TV_MODES       1   // Camera has tv-priority or manual modes with ability to set tv value
+    #undef  CAM_SHOW_OSD_IN_SHOOT_MENU      // On some cameras Canon shoot menu has additional functionality and useful in this case to see CHDK OSD in this mode  
+    #define CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO  1 // Camera can unlock optical zoom in video (if it is locked)
+    #undef  CAM_FEATURE_FEATHER             // Cameras with "feather" or touch wheel.
+    #define CAM_HAS_IS                  1   // Camera has image stabilizer
+
+    #undef  CAM_CONSOLE_LOG_ENABLED         // Development: internal camera stdout -> A/stdout.txt
+    #define CAM_CHDK_HAS_EXT_VIDEO_MENU 1   // In CHDK for this camera realized adjustable video compression
+    #undef  CAM_CAN_MUTE_MICROPHONE         // Camera has function to mute microphone
+
+    #define CAM_EMUL_KEYPRESS_DELAY     40  // Delay to interpret <alt>-button press as longpress
+    #define CAM_EMUL_KEYPRESS_DURATION  5   // Length of keypress emulation
+
+    #undef  CAM_AF_SCAN_DURING_VIDEO_RECORD // CHDK can make single AF scan during video record 
+    #undef  CAM_HAS_VIDEO_BUTTON            // Camera can take stills in video mode, and vice versa
+
+//----------------------------------------------------------
+// Overridden values for each camera
+//----------------------------------------------------------
+
+//==========================================================
+// G-series
+//==========================================================
+#if   defined (CAMERA_g7)
+    #define CAM_PROPSET                 1
+
+    #define CAM_RAW_ROWPIX              3736   // for 10 MP
+    #define CAM_RAW_ROWS                2772   // for 10 MP
+    
+    #undef  CAM_USE_ZOOM_FOR_MF
+    #define CAM_ADJUSTABLE_ALT_BUTTON   1
+    #define CAM_MULTIPART               1
+    #define CAM_HAS_ND_FILTER           1
+    #undef  CAM_HAS_IS
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
+    
+//==========================================================
+// A-series
+//==========================================================
+#elif defined (CAMERA_a450)
+    #define CAM_PROPSET                 2
+
+    #define CAM_RAW_ROWPIX              2664   // for 5 MP 1/3" sensor size
+    #define CAM_RAW_ROWS                1968   // for 5 MP 1/3" sensor size
+
+    #undef  CAM_USE_ZOOM_FOR_MF
+    #undef  CAM_HAS_ZOOM_LEVER
+    #define CAM_DRAW_EXPOSITION         1
+    #undef  CAM_HAS_ERASE_BUTTON
+    #undef  CAM_HAS_IRIS_DIAPHRAGM
+    #define CAM_HAS_ND_FILTER           1
+    #undef  CAM_HAS_MANUAL_FOCUS
+    #undef  CAM_HAS_USER_TV_MODES
+    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
+    #undef  CAM_HAS_IS
+    #define CAM_CAN_MUTE_MICROPHONE     1
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
+    
+//----------------------------------------------------------
+#elif defined (CAMERA_a460)
+    #define CAM_PROPSET                 2
+
+    #define CAM_RAW_ROWPIX              2664   // for 5 MP 1/3" sensor size
+    #define CAM_RAW_ROWS                1968   // for 5 MP 1/3" sensor size
+
+    #undef  CAM_USE_ZOOM_FOR_MF
+    #undef  CAM_HAS_ZOOM_LEVER
+    #define CAM_DRAW_EXPOSITION         1
+    #undef  CAM_HAS_ERASE_BUTTON
+    #undef  CAM_HAS_IRIS_DIAPHRAGM
+    #define CAM_HAS_ND_FILTER           1
+    #undef  CAM_HAS_MANUAL_FOCUS
+    #undef  CAM_HAS_USER_TV_MODES
+    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
+    #undef  CAM_HAS_IS
+    #define CAM_CAN_MUTE_MICROPHONE     1
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
+    
+//----------------------------------------------------------
+#elif defined (CAMERA_a530)
+    #define CAM_PROPSET                 1
+
+//  2672x1968 image - like most other 5m sensors
+    #define CAM_RAW_ROWPIX              2672   // for 5 MP
+    #define CAM_RAW_ROWS                1968   // for 5 MP
+//  2672x1992 image - eventually probably real sensor size
+//  #define CAM_RAW_ROWPIX              2672   // for 5 MP
+//  #define CAM_RAW_ROWS                1992   // for 5 MP
+
+    #undef  CAM_USE_ZOOM_FOR_MF
+    #define CAM_HAS_ERASE_BUTTON	1
+    #undef  CAM_HAS_IRIS_DIAPHRAGM
+    #define CAM_HAS_ND_FILTER           1
+    #define CAM_HAS_MANUAL_FOCUS	1
+    #define CAM_DRAW_EXPOSITION		1
+    #define CAM_SHOW_OSD_IN_SHOOT_MENU	1
+    #undef  CAM_CAN_SD_OVER_NOT_IN_MF
+    #undef  CAM_HAS_IS
+    #define CAM_CAN_MUTE_MICROPHONE     1
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 2
+    
+//----------------------------------------------------------
+#elif defined (CAMERA_a540)
+    #define CAM_PROPSET                 1
+
+    #define CAM_RAW_ROWPIX              2888   // for 6 MP
+    #define CAM_RAW_ROWS                2136   // for 6 MP
+
+    #undef  CAM_USE_ZOOM_FOR_MF
+    #define CAM_HAS_ERASE_BUTTON	1
+    #define CAM_HAS_IRIS_DIAPHRAGM	1
+    #undef  CAM_HAS_ND_FILTER
+    #define CAM_HAS_MANUAL_FOCUS	1
+    #undef  CAM_DRAW_EXPOSITION
+    #define CAM_SHOW_OSD_IN_SHOOT_MENU	1
+    #undef  CAM_HAS_IS
+    #define CAM_CAN_MUTE_MICROPHONE     1
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 2
+    
+//----------------------------------------------------------
+#elif defined (CAMERA_a550)
+    #define CAM_PROPSET                 2
+
+    #define CAM_RAW_ROWPIX              3152   // for 7 MP
+    #define CAM_RAW_ROWS                2340   // for 7 MP
+
+    #undef  CAM_USE_ZOOM_FOR_MF
+    #define CAM_MULTIPART               1
+    #undef  CAM_HAS_ERASE_BUTTON
+    #undef  CAM_HAS_IRIS_DIAPHRAGM
+    #define CAM_HAS_ND_FILTER           1
+    #undef  CAM_HAS_MANUAL_FOCUS
+    #undef  CAM_HAS_USER_TV_MODES
+    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
+    #undef  CAM_HAS_IS
+    #define CAM_CAN_MUTE_MICROPHONE     1
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
+    
+//----------------------------------------------------------
+#elif defined (CAMERA_a560)
+    #define CAM_PROPSET                 2
+
+    #define CAM_RAW_ROWPIX              3152   // for 7 MP
+    #define CAM_RAW_ROWS                2340   // for 7 MP
+
+    #undef  CAM_USE_ZOOM_FOR_MF
+    #define CAM_MULTIPART               1
+    #undef  CAM_HAS_ERASE_BUTTON
+    #undef  CAM_HAS_IRIS_DIAPHRAGM
+    #define CAM_HAS_ND_FILTER           1
+    #undef  CAM_HAS_MANUAL_FOCUS
+    #undef  CAM_HAS_USER_TV_MODES
+    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
+    #undef  CAM_HAS_IS
+    #define CAM_CAN_MUTE_MICROPHONE     1
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
+    
+//----------------------------------------------------------
+#elif defined (CAMERA_a570)
+    #define CAM_PROPSET                 2
+
+    #define CAM_RAW_ROWPIX              3152   // for 7 MP
+    #define CAM_RAW_ROWS                2340   // for 7 MP
+    #define CAM_MULTIPART               1
+    #define CAM_CAN_MUTE_MICROPHONE     1
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
+    
+//----------------------------------------------------------
+#elif defined (CAMERA_a610)
+    #define CAM_PROPSET                 1
+
+    #define CAM_RAW_ROWPIX              2672   // for 5 MP
+    #define CAM_RAW_ROWS                1968   // for 5 MP
+    
+    #define CAM_SWIVEL_SCREEN           1
+    #undef  CAM_CAN_SD_OVER_NOT_IN_MF 
+    #undef  CAM_HAS_IS
+    #define CAM_CAN_MUTE_MICROPHONE     1
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 2
+
+//----------------------------------------------------------
+#elif defined (CAMERA_a620)
+    #define CAM_PROPSET                 1
+
+    #define CAM_RAW_ROWPIX              3152   // for 7 MP
+    #define CAM_RAW_ROWS                2340   // for 7 MP
+    
+    #define CAM_SWIVEL_SCREEN           1
+    #undef  CAM_CAN_SD_OVER_NOT_IN_MF
+    #undef  CAM_HAS_IS    
+    #define CAM_CAN_MUTE_MICROPHONE     1
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 2
+
+//----------------------------------------------------------
+#elif defined (CAMERA_a630)
+    #define CAM_PROPSET                 1
+
+    #define CAM_RAW_ROWPIX              3344   // for 8 MP
+    #define CAM_RAW_ROWS                2484   // for 8 MP
+    
+    #define CAM_SWIVEL_SCREEN           1
+    #define CAM_MULTIPART               1
+    #undef  CAM_CAN_SD_OVER_NOT_IN_MF
+    #undef  CAM_HAS_IS
+    #define CAM_CAN_MUTE_MICROPHONE     1
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
+    
+//----------------------------------------------------------
+#elif defined (CAMERA_a640)
+    #define CAM_PROPSET                 1
+
+    #define CAM_RAW_ROWPIX              3736   // for 10 MP
+    #define CAM_RAW_ROWS                2772   // for 10 MP
+    
+    #define CAM_SWIVEL_SCREEN           1
+    #define CAM_MULTIPART               1
+    #undef  CAM_CAN_SD_OVER_NOT_IN_MF
+    #undef  CAM_HAS_IS
+    #define CAM_CAN_MUTE_MICROPHONE     1
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
+    
+//----------------------------------------------------------
+#elif defined (CAMERA_a650)
+    #define CAM_PROPSET                 2
+    #define CAM_DRYOS                   1
+
+    #define CAM_RAW_ROWPIX              4104   // for 12 MP
+    #define CAM_RAW_ROWS                3048   // for 12 MP
+    
+    #define CAM_ADJUSTABLE_ALT_BUTTON   1
+    #define CAM_SWIVEL_SCREEN           1
+    #define CAM_CAN_MUTE_MICROPHONE     1
+
+    #undef  CAM_EMUL_KEYPRESS_DURATION
+    #define CAM_EMUL_KEYPRESS_DURATION  10
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
+    
+//----------------------------------------------------------
+#elif defined (CAMERA_a700)
+    #define CAM_PROPSET                 1
+
+    #define CAM_RAW_ROWPIX              2888   // for 6 MP
+    #define CAM_RAW_ROWS                2136   // for 6 MP
+
+    #undef  CAM_HAS_IS
+    #define CAM_CAN_MUTE_MICROPHONE     1
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 2
+    
+//----------------------------------------------------------
+#elif defined (CAMERA_a710)
+    #define CAM_PROPSET                 1
+
+    #define CAM_RAW_ROWPIX              3152   // for 7 MP
+    #define CAM_RAW_ROWS                2340   // for 7 MP
+
+    #define CAM_MULTIPART               1
+    #define CAM_CAN_MUTE_MICROPHONE     1
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
+    
+//----------------------------------------------------------
+#elif defined (CAMERA_a720)
+    #define CAM_PROPSET                 2
+    #define CAM_DRYOS                   1
+
+    #define CAM_RAW_ROWPIX              3336   // for new 8 MP
+    #define CAM_RAW_ROWS                2480   // for new 8 MP
+    #define CAM_CAN_MUTE_MICROPHONE     1
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
+
+//==========================================================
+// SD-Series (IXUS-Series)
+//==========================================================
+#elif defined (CAMERA_ixus40_sd300)
+    #define CAM_PROPSET                 1
+
+    #define CAM_RAW_ROWPIX              (2376) //(2272+80) //for 4 MP guessed!!
+    #define CAM_RAW_ROWS                (1704+24) // for 4 MP guessed!!
+
+    #define CAM_USE_ZOOM_FOR_MF 1
+    #undef  CAM_HAS_ERASE_BUTTON
+    #undef  CAM_HAS_IRIS_DIAPHRAGM
+    #define CAM_HAS_ND_FILTER           1
+    #undef  CAM_HAS_MANUAL_FOCUS
+    #undef  CAM_HAS_USER_TV_MODES
+    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
+    #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
+    #undef  CAM_HAS_IS
+    #undef CAM_CONSOLE_LOG_ENABLED
+//----------------------------------------------------------
+
+#elif defined (CAMERA_ixus50_sd400)
+    #define CAM_PROPSET                 1
+
+    #define CAM_RAW_ROWPIX              2672   // for 5 MP
+    #define CAM_RAW_ROWS                1968   // for 5 MP
+
+    #undef  CAM_SYNCH  
+    #undef  CAM_USE_ZOOM_FOR_MF
+    #undef  CAM_HAS_ERASE_BUTTON
+    #undef  CAM_HAS_IRIS_DIAPHRAGM
+    #define CAM_HAS_ND_FILTER           1
+    #undef  CAM_HAS_MANUAL_FOCUS
+    #undef  CAM_HAS_USER_TV_MODES
+    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
+    #undef  CAM_HAS_IS
+	//#define CAM_CONSOLE_LOG_ENABLED     1
+
+//----------------------------------------------------------
+#elif defined (CAMERA_ixus55_sd450)
+    #define CAM_PROPSET                 1
+
+    #define CAM_RAW_ROWPIX              2672   // for 5 MP
+    #define CAM_RAW_ROWS                1968   // for 5 MP
+
+    #undef  CAM_USE_ZOOM_FOR_MF
+    #undef  CAM_HAS_ERASE_BUTTON
+    #undef  CAM_HAS_IRIS_DIAPHRAGM
+    #define CAM_HAS_ND_FILTER           1
+    #undef  CAM_HAS_MANUAL_FOCUS
+    #undef  CAM_HAS_USER_TV_MODES
+    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
+    #undef  CAM_HAS_IS
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 2
+
+//----------------------------------------------------------
+#elif defined (CAMERA_ixus60_sd600)
+    #define CAM_PROPSET                 1
+
+    #define CAM_RAW_ROWPIX              2888   // for 6 MP
+    #define CAM_RAW_ROWS                2136   // for 6 MP
+
+    #undef  CAM_SYNCH
+    #undef  CAM_USE_ZOOM_FOR_MF
+    #undef  CAM_HAS_ERASE_BUTTON
+    #undef  CAM_HAS_IRIS_DIAPHRAGM
+    #define CAM_HAS_ND_FILTER           1
+    #undef  CAM_HAS_MANUAL_FOCUS
+    #undef  CAM_HAS_USER_TV_MODES
+    #define CAM_DRAW_EXPOSITION		    1
+    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
+    #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
+    #define CAM_FEATURE_FEATHER         1
+
+//    #define CAM_CONSOLE_LOG_ENABLED     1  //100a won't compile if this is defined ("undefined reference to `_iosDevFind'")
+    #undef  CAM_HAS_IS
+    #undef  CAM_CHDK_HAS_EXT_VIDEO_MENU
+
+//----------------------------------------------------------
+#elif defined (CAMERA_ixus65_sd630)
+    #define CAM_PROPSET                 1
+
+    #define CAM_RAW_ROWPIX              2888   // for 6 MP
+    #define CAM_RAW_ROWS                2136   // for 6 MP
+
+    #undef  CAM_USE_ZOOM_FOR_MF
+    #undef  CAM_HAS_ERASE_BUTTON
+    #undef  CAM_HAS_IRIS_DIAPHRAGM
+    #define CAM_HAS_ND_FILTER           1
+    #undef  CAM_HAS_MANUAL_FOCUS
+    #undef  CAM_HAS_USER_TV_MODES
+    #define CAM_DRAW_EXPOSITION		    1
+    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
+    #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
+    #define CAM_FEATURE_FEATHER         1
+
+    #define CAM_CONSOLE_LOG_ENABLED     1
+    #undef  CAM_HAS_IS
+    #undef  CAM_CHDK_HAS_EXT_VIDEO_MENU
+
+//----------------------------------------------------------
+#elif defined (CAMERA_ixus70_sd1000)
+    #define CAM_PROPSET                 2
+
+    #define CAM_RAW_ROWPIX              3152   // for 7 MP
+    #define CAM_RAW_ROWS                2340   // for 7 MP
+
+    #undef  CAM_USE_ZOOM_FOR_MF
+    #undef  CAM_HAS_ERASE_BUTTON
+    #undef  CAM_HAS_IRIS_DIAPHRAGM
+    #define CAM_HAS_ND_FILTER           1
+    #undef  CAM_HAS_MANUAL_FOCUS
+    #undef  CAM_HAS_USER_TV_MODES
+    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
+    #undef  CAM_HAS_IS
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
+
+//----------------------------------------------------------
+#elif defined (CAMERA_ixus700_sd500)
+    #define CAM_PROPSET                 1
+
+    #define CAM_RAW_ROWPIX              3152   // for 7 MP
+    #define CAM_RAW_ROWS                2340   // for 7 MP
+
+    #undef  CAM_SYNCH
+    #undef  CAM_USE_ZOOM_FOR_MF
+    #define CAM_DRAW_EXPOSITION         1
+    #undef  CAM_HAS_ERASE_BUTTON
+    #undef  CAM_HAS_IRIS_DIAPHRAGM
+    #define CAM_HAS_ND_FILTER           1
+    #undef  CAM_HAS_MANUAL_FOCUS
+    #undef  CAM_HAS_USER_TV_MODES
+    #undef  CAM_CAN_SD_OVERRIDE
+    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
+    #undef  CAM_HAS_IS
+    #define CAM_MULTIPART               1
+
+//----------------------------------------------------------
+
+#elif defined (CAMERA_ixus750_sd550)
+    #define CAM_PROPSET                1
+
+    #define CAM_RAW_ROWPIX              3152  // for 7 MP
+    #define CAM_RAW_ROWS                2340  // for 7 MP
+
+    #define  CAM_USE_ZOOM_FOR_MF    1
+    #define CAM_DRAW_EXPOSITION        1
+    #undef  CAM_HAS_ERASE_BUTTON
+    #undef  CAM_HAS_IRIS_DIAPHRAGM
+    #define CAM_HAS_ND_FILTER          1
+    #undef  CAM_HAS_MANUAL_FOCUS
+    #undef  CAM_HAS_USER_TV_MODES
+    #define  CAM_CAN_SD_OVERRIDE    1
+    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
+    #undef  CAM_HAS_IS
+    #define CAM_MULTIPART              1 
+    #undef CAM_SYNCH 
+//----------------------------------------------------------
+#elif defined (CAMERA_ixus800_sd700)
+    #define CAM_PROPSET                 1
+
+    #define CAM_RAW_ROWPIX              2888   // for 6 MP
+    #define CAM_RAW_ROWS                2136   // for 6 MP
+
+    #undef  CAM_USE_ZOOM_FOR_MF
+    #define CAM_DRAW_EXPOSITION         1
+    #undef  CAM_HAS_ERASE_BUTTON
+    #undef  CAM_HAS_IRIS_DIAPHRAGM
+    #define CAM_HAS_ND_FILTER           1
+    #undef  CAM_HAS_MANUAL_FOCUS
+    #undef  CAM_HAS_USER_TV_MODES
+    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 2
+    
+//----------------------------------------------------------
+#elif defined (CAMERA_ixus850_sd800)
+    #define CAM_PROPSET                 1
+
+    #define CAM_RAW_ROWPIX              3152   // for 7 MP
+    #define CAM_RAW_ROWS                2340   // for 7 MP
+
+    #undef  CAM_USE_ZOOM_FOR_MF
+    #undef  CAM_HAS_ERASE_BUTTON
+    #undef  CAM_HAS_IRIS_DIAPHRAGM
+    #define CAM_HAS_ND_FILTER           1
+    #undef  CAM_HAS_MANUAL_FOCUS
+    #undef  CAM_HAS_USER_TV_MODES
+    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
+    
+//----------------------------------------------------------
+#elif defined (CAMERA_ixus860_sd870)
+    #define CAM_PROPSET                 2
+    #define CAM_DRYOS                   1
+
+    #define CAM_RAW_ROWPIX              3336   // for new 8 MP
+    #define CAM_RAW_ROWS                2480   // for new 8 MP
+
+    #undef  CAM_USE_ZOOM_FOR_MF
+    #undef  CAM_HAS_ERASE_BUTTON
+    #undef  CAM_HAS_IRIS_DIAPHRAGM
+    #define CAM_HAS_ND_FILTER           1
+    #undef  CAM_HAS_MANUAL_FOCUS
+    #undef  CAM_HAS_USER_TV_MODES
+    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
+  	#define CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO 1
+    #undef  CAM_CAN_MUTE_MICROPHONE
+    
+//----------------------------------------------------------
+#elif defined (CAMERA_ixus950_sd850)
+    #define CAM_PROPSET                 2
+
+    #define CAM_RAW_ROWPIX              3336   // for new 8 MP
+    #define CAM_RAW_ROWS                2480   // for new 8 MP
+
+    #undef  CAM_USE_ZOOM_FOR_MF
+    #undef  CAM_HAS_ERASE_BUTTON
+    #undef  CAM_HAS_IRIS_DIAPHRAGM
+    #define CAM_HAS_ND_FILTER           1
+    #undef  CAM_HAS_MANUAL_FOCUS
+    #undef  CAM_HAS_USER_TV_MODES
+    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
+    #define CAM_MULTIPART               1
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
+    
+//----------------------------------------------------------
+#elif defined (CAMERA_ixus960_sd950)
+    #define CAM_PROPSET                 2
+    #define CAM_DRYOS                   1
+
+    #define CAM_RAW_ROWPIX              4104   
+    #define CAM_RAW_ROWS                3048   
+
+    #undef  CAM_USE_ZOOM_FOR_MF
+    #undef  CAM_HAS_ERASE_BUTTON
+    #undef  CAM_HAS_IRIS_DIAPHRAGM
+    #define CAM_HAS_ND_FILTER           1
+    #undef  CAM_HAS_MANUAL_FOCUS
+    #undef  CAM_HAS_USER_TV_MODES
+    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
+
+//==========================================================
+// S-Series
+//==========================================================
+#elif defined (CAMERA_s2is)
+    #define CAM_PROPSET                 1
+
+    #define CAM_RAW_ROWPIX              2672   // for 5 MP
+    #define CAM_RAW_ROWS                1968   // for 5 MP
+    
+    #undef  CAM_SYNCH   
+    #define CAM_SWIVEL_SCREEN           1
+    #define CAM_ADJUSTABLE_ALT_BUTTON   1
+    #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
+    #define  CAM_HAS_VIDEO_BUTTON       1
+
+
+//----------------------------------------------------------
+#elif defined (CAMERA_s3is)
+    #define CAM_PROPSET                 1
+
+    #define CAM_RAW_ROWPIX              2888   // for 6 MP
+    #define CAM_RAW_ROWS                2136   // for 6 MP
+    
+    #undef  CAM_SYNCH  
+    #define CAM_SWIVEL_SCREEN           1
+    #define CAM_ADJUSTABLE_ALT_BUTTON   1
+    #define CAM_MULTIPART               1
+    #undef  CAM_CAN_SD_OVER_NOT_IN_MF
+    #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
+    #define  CAM_HAS_VIDEO_BUTTON       1
+
+
+//----------------------------------------------------------
+#elif defined (CAMERA_s5is)
+    #define CAM_PROPSET                 2
+    #define CAM_DRYOS                   1
+
+    #define CAM_RAW_ROWPIX              3336   // for new 8 MP
+    #define CAM_RAW_ROWS                2480   // for new 8 MP
+    
+    #define CAM_SWIVEL_SCREEN           1
+    #define CAM_ADJUSTABLE_ALT_BUTTON   1
+    #undef  CAM_CAN_SD_OVER_NOT_IN_MF
+    #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
+    #undef  CAM_CHDK_HAS_EXT_VIDEO_MENU
+    #define  CAM_HAS_VIDEO_BUTTON       1
+
+
+//==========================================================
+// TX-Series
+//==========================================================
+#elif defined (CAMERA_tx1)
+    #define CAM_PROPSET                 2
+    
+    #define CAM_RAW_ROWPIX              3152   // for 7 MP
+    #define CAM_RAW_ROWS                2340   // for 7 MP
+
+    #define CAM_SWIVEL_SCREEN           1
+    #define CAM_HAS_ND_FILTER           1
+    #undef  CAM_HAS_ERASE_BUTTON
+    #undef  CAM_HAS_MANUAL_FOCUS
+    #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
+    #define CAM_MULTIPART               1
+    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
+
+//==========================================================
+// SX-Series
+//==========================================================
+#elif defined (CAMERA_sx100is)
+    #define CAM_PROPSET                 2
+    #define CAM_DRYOS                   1
+
+    #define CAM_RAW_ROWPIX              3336   // for new 8 MP
+    #define CAM_RAW_ROWS                2480   // for new 8 MP
+    #undef CAM_SYNCH 
+#define CAM_CAN_MUTE_MICROPHONE     1 
+#define CAM_AF_SCAN_DURING_VIDEO_RECORD 1 
+   #define CAM_ADJUSTABLE_ALT_BUTTON   1
+   #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
+
+//----------------------------------------------------------
+
+#else
+    #error camera type not defined
+
+#endif
+
+#endif /* CAMERA_H */
Index: /trunk/platform/s2is/kbd.c
===================================================================
--- /trunk/platform/s2is/kbd.c	(revision 511)
+++ /trunk/platform/s2is/kbd.c	(revision 511)
@@ -0,0 +1,519 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+#include "conf.h"
+#include "keyboard.h"
+
+typedef struct {
+	short grp;
+	short hackkey;
+	long canonkey;
+} KeyMap;
+
+
+static long kbd_new_state[3];
+static long kbd_prev_state[3];
+static long kbd_mod_state[3];
+long physw_copy[3];
+static KeyMap keymap[];
+static long last_kbd_key = 0;
+static long alt_mode_key_mask = 0x00004000;
+static int usb_power;
+static int remote_key, remote_count;
+static int shoot_counter=0;
+#define DELAY_TIMEOUT 10000
+
+#define KEYS_MASK0 (0x00000003)
+#define KEYS_MASK1 (0x5f7f7038)
+#define KEYS_MASK2 (0x00000000)
+
+#define NEW_SS (0x2000)
+#define SD_READONLY_FLAG (0x20000)
+#define USB_MASK (8) 
+#define USB_REG (2)
+ 
+#ifndef MALLOCD_STACK
+static char kbd_stack[NEW_SS];
+#endif
+
+extern void _platformsub_kbd_fetch_data(long*);
+long __attribute__((naked)) wrap_kbd_p1_f();
+void __attribute__((naked,noinline)) mykbd_task_proceed_2();
+extern void h_kbd_p2_f();
+
+
+void wait_until_remote_button_is_released(void)
+{
+
+long x[3];
+int count1;
+int count2;
+int tick,tick2,tick3;
+int nSW;
+int prev_usb_power,cur_usb_power;
+// ------ add by Masuji SUTO (start) --------------
+    static int nMode;
+ // ------ add by Masuji SUTO (end)   --------------
+
+asm volatile ("STMFD SP!, {R0-R11,LR}\n"); // store R0-R11 and LR in stack
+/*
+debug_led(1);
+
+//
+tick = get_tick_count();
+tick2 = tick;
+if (conf.synch_enable && conf.ricoh_ca1_mode && conf.remote_enable && (!shooting_get_drive_mode()|| ((shooting_get_drive_mode()==2) && state_shooting_progress != SHOOTING_PROGRESS_PROCESSING)))  // synch mode enable so wait for USB to disconnect
+
+  {
+// ------ add by Masuji SUTO (start) --------------
+        nMode=0;
+          _platformsub_kbd_fetch_data(x);
+    _kbd_read_keys_r2(x);
+        if((x[2]&USB_MASK)==USB_MASK) nMode=1;
+// ------ add by Masuji SUTO (end)   --------------
+if(conf.ricoh_ca1_mode && conf.remote_enable)			//ricoh_ca1_mode
+{
+	if(shooting_get_drive_mode()==1 && state_shooting_progress == SHOOTING_PROGRESS_PROCESSING){			//continuous-shooting mode
+		if(conf.bracket_type>2){
+			if(shoot_counter<2) shutter_int=3;
+			shoot_counter--;
+			}
+		else{
+			prev_usb_power=0;
+			nSW = 0;
+			do
+				{     
+_platformsub_kbd_fetch_data(x);
+_kbd_read_keys_r2(x);
+				cur_usb_power = (x[2]&USB_MASK)==USB_MASK;
+				if(cur_usb_power){
+					if(!prev_usb_power){
+						tick2 = get_tick_count();
+						prev_usb_power=cur_usb_power;
+						}
+					else{
+						if((int)get_tick_count()-tick2>1000) {debug_led(0);}
+						}
+					}
+				else{
+					if(prev_usb_power){
+						tick3 = (int)get_tick_count()-tick2;
+						if(nSW==10) {
+							if(tick3>50) shutter_int=1;
+							nSW=20;
+							}
+						if(nSW==0 && tick3>0) {
+							if(tick3<50) {
+							nSW=10;
+							}
+						else{
+							if(tick3>1000) shutter_int=1;
+								nSW=20;
+							}
+						}
+						prev_usb_power=cur_usb_power;
+						}
+					}
+				if((int)get_tick_count()-tick >= DELAY_TIMEOUT) {nSW=20;shutter_int=2;}
+				}
+			 while(nSW<20);
+			 }
+		} 		//continuous-shooting mode 
+		else{		//nomal mode 
+			shoot_counter=0;
+			if(conf.bracket_type>2){
+				shoot_counter=(conf.bracket_type-2)*2;
+				}
+		   do
+		         {     
+          _platformsub_kbd_fetch_data(x);
+    _kbd_read_keys_r2(x);
+		           }
+		//   while(((x[2]&USB_MASK)==USB_MASK) && ((int)get_tick_count()-tick < DELAY_TIMEOUT));
+		// ------ modif by Masuji SUTO (start) --------------
+		        while(((((x[2]&USB_MASK)!=USB_MASK) && (nMode==0)) || (((x[2]&USB_MASK)==USB_MASK) && (nMode==1))) && ((int)get_tick_count()-tick < DELAY_TIMEOUT));
+		// ------ modif by Masuji SUTO (end)   --------------
+		} 		//nomal mode 
+	}		//ricoh_ca1_mode
+else		//ricoh_ca1_mode disebale
+   {
+
+   do
+         {
+
+          _platformsub_kbd_fetch_data(x);
+    _kbd_read_keys_r2(x);
+
+             
+           }
+
+  while(((x[2]&USB_MASK)!=USB_MASK)&&  ((int)get_tick_count()-tick < DELAY_TIMEOUT));
+    }
+
+
+  }
+
+if (conf.synch_delay_enable && conf.synch_delay_value>0)                                // if delay is switched on and greater than 0
+  {
+    for (count1=0;count1<conf.synch_delay_value+(conf.synch_delay_coarse_value*1000);count1++) // wait delay_value * 0.1ms
+    {
+      for (count2=0;count2<1400;count2++)            // delay approx. 0.1ms
+        {
+        }
+     }
+  }
+//
+
+debug_led(0);
+*/
+asm volatile ("LDMFD SP!, {R0-R11,LR}\n"); // restore R0-R11 and LR from stack
+}
+
+static void __attribute__((noinline)) mykbd_task_proceed()
+{
+    asm volatile(
+                 "STMFD   SP!, {R4-R6,LR}\n"
+                 "SUB     SP, SP, #4\n"
+                 "ADD     R6, SP, #2\n"
+		 "B	  mykbd_task_proceed_2\n"
+	);
+}
+
+
+void mykbd_task_proceed_2()
+{
+    asm volatile(
+  "loc_FF82934C:"
+                 "MOV     R0, #0xA\n"
+                 "BL      _SleepTask\n"
+                 "BL      wrap_kbd_p1_f\n"
+                 "MOV     R5, R0\n"
+                 "CMP     R5, #1\n"
+	         "BNE     loc_FF82934C\n"
+		 "B	  h_kbd_p2_f\n"
+	);
+}
+
+
+void __attribute__((naked,noinline))
+mykbd_task(long ua, long ub, long uc, long ud, long ue, long uf)
+{
+    /* WARNING
+     * Stack pointer manipulation performed here!
+     * This means (but not limited to):
+     *	function arguments destroyed;
+     *	function CAN NOT return properly;
+     *	MUST NOT call or use stack variables before stack
+     *	is setup properly;
+     *
+     */
+
+    register int i;
+    register long *newstack;
+
+#ifndef MALLOCD_STACK
+    newstack = (void*)kbd_stack;
+#else
+    newstack = malloc(NEW_SS);
+#endif
+
+    for (i=0;i<NEW_SS/4;i++)
+	newstack[i]=0xdededede;
+
+    asm volatile (
+	"MOV	SP, %0"
+	:: "r"(((char*)newstack)+NEW_SS)
+	: "memory"
+    );
+
+    mykbd_task_proceed();
+
+    /* function can be modified to restore SP here...
+     */
+
+    _ExitTask();
+}
+
+
+long __attribute__((naked,noinline)) wrap_kbd_p1_f()
+{
+    kbd_prev_state[0] = kbd_new_state[0];
+    kbd_prev_state[1] = kbd_new_state[1];
+    kbd_prev_state[2] = kbd_new_state[2];
+
+    asm volatile(
+                "STMFD   SP!, {R4-R10,LR}\n"
+                "LDR     R4, =physw_status-0x30\n"
+                "MOV     R0, R4\n"
+                "SUB     SP, SP, #0x18\n"
+                "BL      my_kbd_read_keys\n"
+    );
+
+//    physw_status[0] = physw_status[0] & ~SD_READONLY_FLAG;
+
+    asm volatile(
+		"B	 _kbd_p1_f_cont\n"
+    );
+    return 0; // shut up the compiler
+}
+
+
+void __attribute__((naked,noinline)) my_kbd_read_keys()
+{
+    asm volatile(
+                "STMFD   SP!, {R4-R11,LR}\n"
+                "LDR     R3, =kbd_const_1\n"
+                "SUB     SP, SP, #0x18\n"
+                "MOV     R5, R0\n"
+                "ADD     R0, SP, #0x0C\n"
+                "LDR     R4, [R3]\n"
+                "BL      _platformsub_kbd_fetch_data\n"
+                "ADD     R0, SP, #0x0C\n"
+                "BL      my_kbd_read_keys_cont\n"
+		"B	 _kbd_read_keys_r2\n"
+    );
+}
+
+
+void my_kbd_read_keys_cont(long *canon_key_state)
+{
+    kbd_new_state[0] = canon_key_state[0];
+    kbd_new_state[1] = canon_key_state[1];
+    kbd_new_state[2] = canon_key_state[2];
+
+    kbd_new_state[0] = kbd_new_state[0] & ~SD_READONLY_FLAG;
+
+    physw_copy[0] = kbd_new_state[0];
+    physw_copy[1] = kbd_new_state[1];
+    physw_copy[2] = kbd_new_state[2];
+
+    if (kbd_process() == 0){
+	// leave it alone...
+	physw_status[0] = kbd_new_state[0];
+	physw_status[1] = kbd_new_state[1];
+	physw_status[2] = kbd_new_state[2];
+        physw_status[1] |= alt_mode_key_mask;
+    } else {
+	// override keys
+	physw_status[0] = (kbd_new_state[0] & (~KEYS_MASK0)) |
+			  (kbd_mod_state[0] & KEYS_MASK0);
+
+	physw_status[1] = (kbd_new_state[1] & (~KEYS_MASK1)) |
+			  (kbd_mod_state[1] & KEYS_MASK1);
+
+	physw_status[2] = (kbd_new_state[2] & (~KEYS_MASK2)) |
+			  (kbd_mod_state[2] & KEYS_MASK2);
+    }
+
+    canon_key_state[0] = physw_status[0];
+    canon_key_state[1] = physw_status[1];
+    canon_key_state[2] = physw_status[2];
+	// phot's code
+		remote_key = (physw_status[2] & USB_MASK)==USB_MASK;
+		if (remote_key) 
+			remote_count += 1;
+		else if (remote_count) {
+			usb_power = remote_count;
+			remote_count = 0;
+		}
+	if (conf.remote_enable) {
+		physw_status[2] =  physw_status[2] & ~SD_READONLY_FLAG;
+	}
+
+}
+int get_usb_power(int edge)
+{
+	int x;
+
+	if (edge) return remote_key;
+	x = usb_power;
+	usb_power = 0;
+	return x;
+}
+
+/****************/
+
+void kbd_set_alt_mode_key_mask(long key)
+{
+    int i;
+    for (i=0; keymap[i].hackkey; ++i) {
+	if (keymap[i].hackkey == key) {
+	    alt_mode_key_mask = keymap[i].canonkey;
+	    return;
+	}
+    }
+}
+
+void kbd_key_press(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    kbd_mod_state[keymap[i].grp] &= ~keymap[i].canonkey;
+	    return;
+	}
+    }
+}
+
+void kbd_key_release(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    kbd_mod_state[keymap[i].grp] |= keymap[i].canonkey;
+	    return;
+	}
+    }
+}
+
+void kbd_key_release_all()
+{
+  kbd_mod_state[0] |= KEYS_MASK0;
+  kbd_mod_state[1] |= KEYS_MASK1;
+  kbd_mod_state[2] |= KEYS_MASK2;
+}
+
+long kbd_is_key_pressed(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    return ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0) ? 1:0;
+	}
+    }
+    return 0;
+}
+
+long kbd_is_key_clicked(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    return ((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
+		    ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0);
+	}
+    }
+    return 0;
+}
+
+long kbd_get_pressed_key()
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0){
+	    return keymap[i].hackkey;
+	}
+    }
+    return 0;
+}
+
+long kbd_get_clicked_key()
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
+	    ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0)){
+	    return keymap[i].hackkey;
+	}
+    }
+    return 0;
+}
+
+void kbd_reset_autoclicked_key() {
+    last_kbd_key = 0;
+}
+
+long kbd_get_autoclicked_key() {
+    static long last_kbd_time = 0, press_count = 0;
+    register long key, t;
+
+    key=kbd_get_clicked_key();
+    if (key) {
+        last_kbd_key = key;
+        press_count = 0;
+        last_kbd_time = get_tick_count();
+        return key;
+    } else {
+        if (last_kbd_key && kbd_is_key_pressed(last_kbd_key)) {
+            t = get_tick_count();
+            if (t-last_kbd_time>((press_count)?175:500)) {
+                ++press_count;
+                last_kbd_time = t;
+                return last_kbd_key;
+            } else {
+                return 0;
+            }
+        } else {
+            last_kbd_key = 0;
+            return 0;
+        }
+    }
+}
+
+long kbd_use_zoom_as_mf() {
+    static long v;
+    static long zoom_key_pressed = 0;
+
+    if (kbd_is_key_pressed(KEY_ZOOM_IN) && kbd_is_key_pressed(KEY_MF) && (mode_get()&MODE_MASK) == MODE_REC) {
+        get_property_case(PROPCASE_FOCUS_MODE, &v, 4);
+        if (v) {
+            kbd_key_release_all();
+            kbd_key_press(KEY_MF);
+            kbd_key_press(KEY_UP);
+            zoom_key_pressed = KEY_ZOOM_IN;
+            return 1;
+        }
+    } else {
+        if (zoom_key_pressed==KEY_ZOOM_IN) {
+            kbd_key_release(KEY_UP);
+            zoom_key_pressed = 0;
+            return 1;
+        }
+    }
+    if (kbd_is_key_pressed(KEY_ZOOM_OUT) && kbd_is_key_pressed(KEY_MF) && (mode_get()&MODE_MASK) == MODE_REC) {
+        get_property_case(PROPCASE_FOCUS_MODE, &v, 4);
+        if (v) {
+            kbd_key_release_all();
+            kbd_key_press(KEY_MF);
+            kbd_key_press(KEY_DOWN);
+            zoom_key_pressed = KEY_ZOOM_OUT;
+            return 1;
+        }
+    } else {
+        if (zoom_key_pressed==KEY_ZOOM_OUT) {
+            kbd_key_release(KEY_DOWN);
+            zoom_key_pressed = 0;
+            return 1;
+        }
+    }
+    return 0;
+}
+static KeyMap keymap[] = {
+    /* tiny bug: key order matters. see kbd_get_pressed_key()
+     * for example
+     */
+	{ 1, KEY_UP		, 0x00020000 },
+	{ 1, KEY_DOWN		, 0x00080000 },
+	{ 1, KEY_LEFT		, 0x00010000 },
+	{ 1, KEY_RIGHT		, 0x00040000 },
+	{ 1, KEY_SET		, 0x00100000 },
+	{ 0, KEY_SHOOT_FULL	, 0x00000003 },
+	{ 0, KEY_SHOOT_HALF	, 0x00000001 },
+	{ 1, KEY_ZOOM_IN	, 0x10000000 },
+	{ 1, KEY_ZOOM_IN	, 0x18000000 },
+	{ 1, KEY_ZOOM_OUT	, 0x01000000 },
+	{ 1, KEY_ZOOM_OUT	, 0x05000000 },
+	{ 1, KEY_MENU		, 0x00200000 },
+	{ 1, KEY_DISPLAY	, 0x00002000 },
+	{ 1, KEY_PRINT		, 0x00004000 },
+	{ 1, KEY_ERASE		, 0x00400000 },
+        { 1, KEY_ISO		, 0x00001000 },
+        { 1, KEY_FLASH		, 0x00000008 },
+        { 1, KEY_MF		, 0x00000010 },
+        { 1, KEY_MACRO		, 0x00000020 },
+        { 1, KEY_VIDEO		, 0x40000000 },
+        { 1, KEY_TIMER		, 0x02000000 },
+//        { 1, KEY_DUMMY   	, 0x00000000 },
+	{ 0, 0, 0 }
+};
+
Index: /trunk/platform/s2is/wrappers.c
===================================================================
--- /trunk/platform/s2is/wrappers.c	(revision 511)
+++ /trunk/platform/s2is/wrappers.c	(revision 511)
@@ -0,0 +1,22 @@
+#include "keyboard.h"
+#include "conf.h"
+#include "platform.h"
+#include "../generic/wrappers.c"
+
+long lens_get_focus_pos()
+{
+    static long v=MAX_DIST;
+    return (kbd_is_key_pressed(KEY_SHOOT_HALF) || state_kbd_script_run || shooting_get_focus_mode())?v=_GetFocusLensSubjectDistance():v;
+}
+
+long lens_get_focus_pos_from_lense()
+{
+   static long v=MAX_DIST;
+   return (kbd_is_key_pressed(KEY_SHOOT_HALF) || state_kbd_script_run  || shooting_get_focus_mode())?v=_GetFocusLensSubjectDistanceFromLens():v;
+}
+
+long lens_get_target_distance()
+{
+    static long v=MAX_DIST;
+    return (kbd_is_key_pressed(KEY_SHOOT_HALF) || state_kbd_script_run  || shooting_get_focus_mode())?v=_GetCurrentTargetDistance():v;
+}
Index: /trunk/platform/s2is/main.c
===================================================================
--- /trunk/platform/s2is/main.c	(revision 511)
+++ /trunk/platform/s2is/main.c	(revision 511)
@@ -0,0 +1,245 @@
+#define VBATT_DEFAULT_MIN (4550)
+#define VBATT_DEFAULT_MAX (5150)
+
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+#include "keyboard.h"
+
+/* Ours stuff */
+extern long link_bss_start;
+extern long link_bss_end;
+extern void boot();
+extern void mykbd_task(long ua, long ub, long uc, long ud, long ue, long uf);
+
+
+static int stop_hooking;
+
+static void (*taskprev)(
+    long p0,    long p1,    long p2,    long p3,    long p4,
+    long p5,    long p6,    long p7,    long p8,    long p9);
+
+static void (*taskfsprev)(
+    long p0,    long p1,    long p2,    long p3,    long p4,
+    long p5,    long p6,    long p7,    long p8,    long p9);
+
+
+
+void spytask(long ua, long ub, long uc, long ud, long ue, long uf)
+{
+    core_spytask();
+}
+
+
+static void task_start_hook(
+    long p0,    long p1,    long p2,    long p3,    long p4,
+    long p5,    long p6,    long p7,    long p8,    long p9)
+{
+    _CreateTask("SpyTask", 0x19, 0x2000, spytask, 0);
+
+    taskprev(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9 );
+}
+
+
+
+static void task_fs(
+    long p0,    long p1,    long p2,    long p3,    long p4,
+    long p5,    long p6,    long p7,    long p8,    long p9)
+{
+    remount_filesystem();
+    taskfsprev(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9 );
+}
+
+
+static void capt_seq_hook(
+    long p0,    long p1,    long p2,    long p3,    long p4,
+    long p5,    long p6,    long p7,    long p8,    long p9)
+{
+    capt_seq_task();
+}
+
+
+static void movie_record_hook(
+    long p0,    long p1,    long p2,    long p3,    long p4,
+    long p5,    long p6,    long p7,    long p8,    long p9)
+{
+    movie_record_task();
+}
+
+
+static int my_ncmp(const char *s1, const char *s2, long len)
+{
+    int i;
+    for (i=0;i<len;i++){
+	if (s1[i] != s2[i])
+	    return 1;
+    }
+    return 0;
+}
+
+void createHook (void *pNewTcb)
+{
+    char *name = (char*)(*(long*)((char*)pNewTcb+0x34));
+    long *entry = (long*)((char*)pNewTcb+0x74);
+
+    // always hook first task creation
+    // to create SpyProc
+    if (!stop_hooking){
+	taskprev = (void*)(*entry);
+	*entry = (long)task_start_hook;
+	stop_hooking = 1;
+    } else {
+	// hook/replace another tasks
+	if (my_ncmp(name, "tSwitchChe", 10) == 0){
+	    *entry = (long)mykbd_task;
+	}
+	if (my_ncmp(name, "tInitFileM", 10) == 0){
+	    taskfsprev = (void*)(*entry);
+	    *entry = (long)task_fs;
+	}
+
+	if (my_ncmp(name, "tCaptSeqTa", 10) == 0){
+	    *entry = (long)capt_seq_hook;
+	}
+
+	if (my_ncmp(name, "tMovieRecT", 10) == 0){
+	    *entry = (long)movie_record_hook;
+	}
+
+	core_hook_task_create(pNewTcb);
+    }
+}
+
+void deleteHook (void *pTcb)
+{
+    core_hook_task_delete(pTcb);
+}
+
+void startup()
+{
+    long *bss = &link_bss_start;
+    long *ptr;
+
+    // sanity check
+    if ((long)&link_bss_end > (MEMISOSTART + MEMISOSIZE)){
+	started();
+	shutdown();
+    }
+
+    // initialize .bss senment
+    while (bss<&link_bss_end)
+	*bss++ = 0;
+
+    // fill memory with this magic value so we could see what
+    // parts of memory were or not used
+    
+    // update:
+    // this seems to be required for unknown reason
+    // or else sryproc startup will fail from
+    // time to time...
+#if 0
+    for (ptr=(void*)MEMBASEADDR;((long)ptr)<MEMISOSTART;ptr+=4){
+	ptr[0]=0x55555555;
+	ptr[1]=0x55555555;
+	ptr[2]=0x55555555;
+	ptr[3]=0x55555555;
+    }
+#endif
+
+    boot();
+}
+
+long get_vbatt_min()
+{
+    return 4550;
+}
+
+long get_vbatt_max()
+{
+    return 5150;
+}
+
+static const struct {
+    int zp, fl;
+} fl_tbl[] = {
+    {   0,   6000 },
+    {  11,   6400 },
+    {  41,  12100 },
+    {  64,  21300 },
+    {  86,  41600 },
+    { 105,  61400 },
+    { 128,  72000 },
+};
+#define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0]))
+#define CF_EFL 6000
+
+const int zoom_points = 129;
+
+int get_effective_focal_length(int zp) {
+    return (CF_EFL*get_focal_length(zp))/1000;
+}
+
+int get_focal_length(int zp) {
+    int i;
+
+    if (zp<fl_tbl[0].zp)
+        return fl_tbl[0].fl;
+    else if (zp>fl_tbl[NUM_FL-1].zp)
+        return fl_tbl[NUM_FL-1].fl;
+    else 
+        for (i=1; i<NUM_FL; ++i) {
+           if (zp==fl_tbl[i-1].zp) 
+               return fl_tbl[i-1].fl;
+           else if (zp==fl_tbl[i].zp) 
+               return fl_tbl[i].fl;
+           else if (zp<fl_tbl[i].zp)
+               return fl_tbl[i-1].fl+(zp-fl_tbl[i-1].zp)*(fl_tbl[i].fl-fl_tbl[i-1].fl)/(fl_tbl[i].zp-fl_tbl[i-1].zp);
+        }
+    return fl_tbl[NUM_FL-1].fl;
+}
+
+int get_zoom_x(int zp) {
+    return get_focal_length(zp)*10/fl_tbl[0].fl;
+}
+
+static struct {
+	int hackmode;
+	int canonmode;
+} modemap[] = {
+    { MODE_AUTO,                5 },
+    { MODE_P,                   1 },
+    { MODE_TV,                  3 },
+    { MODE_AV,                  2 },
+    { MODE_M,                   0 },
+    { MODE_PORTRAIT,            6 },
+    { MODE_NIGHT,               8 },
+    { MODE_LANDSCAPE,           7 },
+    { MODE_VIDEO_STD,           16  },
+    { MODE_STITCH,              0xFF },
+    { MODE_MY_COLORS,           4 },
+    { MODE_SCN_NIGHT,           14 },
+    { MODE_SCN_CHILD,           0xFF },
+    { MODE_SCN_PARTY,           13 },
+    { MODE_SCN_GRASS,           9 },
+    { MODE_SCN_SNOW,            10 },
+    { MODE_SCN_BEACH,           11 },
+    { MODE_SCN_FIREWORK,        12 }, 
+    { MODE_SCN_COLOR_ACCENT,    0xFF } 
+};
+#define MODESCNT (sizeof(modemap)/sizeof(modemap[0]))
+
+int mode_get() {
+    int mode, i, t=0xFF;
+    mode  = (playrec_mode==1)?MODE_REC:MODE_PLAY;
+    mode |= (physw_copy[1] & 0x00000001)?0:MODE_SCREEN_OPENED;
+    mode |= (physw_copy[1] & 0x00000002)?0:MODE_SCREEN_ROTATED;
+    
+    t=0xFF;
+    _GetPropertyCase(PROPCASE_SHOOTING_MODE, &t, 4);
+    for (i=0; i<MODESCNT; ++i) {
+	if (modemap[i].canonmode == t) {
+	    return (mode | (modemap[i].hackmode & MODE_SHOOTING_MASK));
+	}
+    }
+    return (mode);
+}
Index: /trunk/platform/s2is/notes.txt
===================================================================
--- /trunk/platform/s2is/notes.txt	(revision 511)
+++ /trunk/platform/s2is/notes.txt	(revision 511)
@@ -0,0 +1,8 @@
+****************************************
+
+Camera depending notes: 
+
+- s2is uses Propset 1 of Properties (see http://tinyurl.com/6zbv9b)
+- s2is does have a REAL IRIS Diaphragm, it does NOT have an an ND Filter! 
+Mind this.
+- CHDK for firmware 1.00i is the SAME for 1.00g
Index: /trunk/platform/s2is/lib.c
===================================================================
--- /trunk/platform/s2is/lib.c	(revision 511)
+++ /trunk/platform/s2is/lib.c	(revision 511)
@@ -0,0 +1,75 @@
+#include "platform.h"
+#include "lolevel.h"
+
+void shutdown()
+{
+    volatile long *p = (void*)0xc022002c;
+        
+    asm(
+         "MRS     R1, CPSR\n"
+         "AND     R0, R1, #0x80\n"
+         "ORR     R1, R1, #0x80\n"
+         "MSR     CPSR_cf, R1\n"
+         :::"r1","r0");
+        
+    *p = 0x46;
+
+    while(1);
+}
+
+
+#define LED_PR 0xc0220088
+
+#define LED_BRIGHTNESS  200
+#define LED_GREEN       4
+#define LED_YELLOW      5
+#define LED_ORANGE      7
+#define LED_BLUE        8
+#define LED_AF_BEAM     9
+#define LED_TIMER       10
+  
+static void led_on(const int led, const int brightness)
+{
+    if (led < 4 || led > 10 || led == 6) return;
+    static void* addr;
+    addr = led_table + (led * 0x40);
+    _UniqueLedOn(addr,brightness);
+}
+ 
+static void led_off(const int led)
+{
+    if (led < 4 || led > 10 || led == 6) return;
+    static void* addr;
+    addr = led_table + (led * 0x40);
+    _UniqueLedOff(addr);
+}
+
+void debug_led(int state)
+{
+    if (state)
+        led_on(LED_BLUE, LED_BRIGHTNESS);
+    else
+        led_off(LED_BLUE);
+}
+
+int get_flash_params_count(void){
+ return 85;
+}
+
+void ubasic_set_led(int led, int state, int bright)
+{
+	if (state) {
+		if (bright > LED_BRIGHTNESS) bright = LED_BRIGHTNESS;
+		if (led == 6) {
+	        led_on(4, bright);
+		    led_on(5, bright);
+		} else
+			led_on(led, bright);
+	}
+    else
+		if (led == 6) {
+	        led_off(4);
+		    led_off(5);
+		} else
+        led_off(led);
+}
Index: /trunk/platform/s2is/sub/100e/capt_seq.c
===================================================================
--- /trunk/platform/s2is/sub/100e/capt_seq.c	(revision 511)
+++ /trunk/platform/s2is/sub/100e/capt_seq.c	(revision 511)
@@ -0,0 +1,287 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+#define RAWDATA_AVAILABLE (1)
+#define RAWDATA_SAVED (2)
+
+#define NR_ON (1)
+#define NR_OFF (0)
+
+static long raw_save_stage;
+
+void capt_seq_hook_raw_here()
+{
+    raw_save_stage = RAWDATA_AVAILABLE;
+    core_rawdata_available();
+    while (raw_save_stage != RAWDATA_SAVED){
+	_SleepTask(10);
+    }
+}
+
+void hook_raw_save_complete()
+{
+    raw_save_stage = RAWDATA_SAVED;
+}
+
+
+void capt_seq_hook_set_nr()
+{
+    long *nrflag = (long*)0x5724;
+
+    switch (core_get_noise_reduction_value()){
+    case NOISE_REDUCTION_AUTO_CANON:
+	// leave it alone
+	break;
+    case NOISE_REDUCTION_OFF:
+	*nrflag = 0;
+	break;
+    case NOISE_REDUCTION_ON:
+	*nrflag = 1;
+	break;
+    };
+}
+
+
+void __attribute__((naked,noinline)) sub_FF96F5D0_my(long p)
+{
+    asm volatile (
+                "STMFD   SP!, {R4-R8,LR}\n"
+                "LDR     R3, =0x571C\n"
+                "SUB     SP, SP, #4\n"
+                "LDR     R2, [R3]\n"
+                "LDR     R4, =0x5720\n"
+                "CMP     R2, #0\n"
+                "STR     R0, [R4]\n"
+                "MOV     R8, #0\n"
+                "LDR     R6, =0xFF96F508\n"
+                "BNE     loc_FF96F604\n"
+                "LDR     R0, =0xFF96F5C4\n"
+                "MOV     R1, #0xDB\n"
+                "BL      sub_FF813D58\n"
+"loc_FF96F604:\n"
+                "LDR     R3, =0x5D164\n"
+                "LDR     R1, =0xFFFFFFFF\n"
+                "LDR     R0, [R3]\n"
+                "BL      sub_FF8208C8\n"
+                "BL      sub_FF96F540\n"
+         //   "BL      wait_until_remote_button_is_released\n"
+	    	"BL      capt_seq_hook_set_nr\n"
+
+		"B       sub_FF96F618\n"
+    );
+}
+
+void __attribute__((naked,noinline)) sub_FF96C05C_my(long p)
+{
+    asm volatile (
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "LDR     R5, [R0,#8]\n"
+                "BL      sub_FF97AE48\n"
+                "CMP     R0, #0\n"
+                "LDR     R0, =0xFF96C038\n"
+                "BNE     loc_FF96C07C\n"
+                "BL      sub_FFAF213C\n"
+                "BL      sub_FF97AE54\n"
+"loc_FF96C07C:\n"
+                "BL      sub_FF96A0BC\n"
+                "ADD     R3, R5, R5,LSL#1\n"
+                "RSB     R3, R5, R3,LSL#3\n"
+                "MOV     R6, R3,LSL#2\n"
+                "ADD     R0, R6, R0\n"
+                "LDR     R3, [R0,#8]\n"
+                "CMP     R3, #0\n"
+                "BEQ     loc_FF96C0A0\n"
+                "BL      sub_FF953B98\n"
+"loc_FF96C0A0:\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FF96E07C\n"
+                "TST     R0, #1\n"
+                "MOV     R2, R5\n"
+                "MOV     R1, #1\n"
+                "BEQ     loc_FF96C0C0\n"
+                "LDMFD   SP!, {R4-R6,LR}\n"
+                "B       sub_FF96AE1C\n"
+"loc_FF96C0C0:\n"
+                "BL      sub_FF96A0BC\n"
+                "MOV     R4, R0\n"
+                "BL      sub_FF825F00\n"
+                "ADD     R4, R6, R4\n"
+                "STR     R0, [R4,#4]\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FF96FF14\n"
+                "BL      sub_FF96E6D8\n"
+                "BL      sub_FF96E644\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FF96F5D0_my\n"
+                "BL      capt_seq_hook_raw_here\n"
+                "MOV     R2, R5\n"
+                "MOV     R1, #1\n"
+                "BL      sub_FF96AE1C\n"
+                "BL      sub_FF96F894\n"
+                "BL      sub_FF96A0BC\n"
+                "ADD     R0, R6, R0\n"
+                "LDR     R3, [R0,#8]\n"
+                "CMP     R3, #0\n"
+                "LDMEQFD SP!, {R4-R6,PC}\n"
+                "LDMFD   SP!, {R4-R6,LR}\n"
+                "B       sub_FF953BD4\n"
+
+    );
+}
+
+void __attribute__((naked,noinline)) capt_seq_task()
+{
+	asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                "SUB     SP, SP, #4\n"
+                "MOV     R4, SP\n"
+                "B       loc_FF96CBD8\n"
+"loc_FF96CA28:\n"
+                "LDR     R0, [SP,#0xC-0xC]\n"
+                "LDR     R3, [R0]\n"
+                "CMP     R3, #0x11\n"
+                "LDRLS   PC, [PC,R3,LSL#2]\n"
+                "B       loc_FF96CBC0\n"
+                ".long loc_FF96CA84\n"
+                ".long loc_FF96CA94\n"
+                ".long loc_FF96CAA8\n"
+                ".long loc_FF96CAB8\n"
+                ".long loc_FF96CAC8\n"
+                ".long loc_FF96CAD8\n"
+                ".long loc_FF96CAEC\n"
+                ".long loc_FF96CAFC\n"
+                ".long loc_FF96CB10\n"
+                ".long loc_FF96CB20\n"
+                ".long loc_FF96CB30\n"
+                ".long loc_FF96CB40\n"
+                ".long loc_FF96CB50\n"
+                ".long loc_FF96CB64\n"
+                ".long loc_FF96CB74\n"
+                ".long loc_FF96CB84\n"
+                ".long loc_FF96CB94\n"
+                ".long loc_FF96CBA8\n"
+"loc_FF96CA84:\n"
+                "BL      sub_FF96D24C\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #8\n"
+                "B       loc_FF96CBB4\n"
+"loc_FF96CA94:\n"
+                "BL      sub_FF96D9D0\n"
+                "BL      shooting_expo_param_override\n"  // +
+                "BL      sub_FF96A98C\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x10\n"
+                "B       loc_FF96CBB4\n"
+"loc_FF96CAA8:\n"
+                "BL      sub_FF96C05C_my\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #2\n"
+                "B       loc_FF96CBB4\n"
+"loc_FF96CAB8:\n"
+                "BL      sub_FF96DFE0\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #1\n"
+                "B       loc_FF96CBB4\n"
+"loc_FF96CAC8:\n"
+                "BL      sub_FF96DA80\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x20\n"
+                "B       loc_FF96CBB4\n"
+"loc_FF96CAD8:\n"
+                "BL      sub_FF96DB78\n"
+                "BL      sub_FF96A98C\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x40\n"
+                "B       loc_FF96CBB4\n"
+"loc_FF96CAEC:\n"
+                "BL      sub_FF96C240\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x80\n"
+                "B       loc_FF96CBB4\n"
+"loc_FF96CAFC:\n"
+                "BL      sub_FF96DCF0\n"
+                "BL      sub_FF96A98C\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x400\n"
+                "B       loc_FF96CBB4\n"
+"loc_FF96CB10:\n"
+                "BL      sub_FF96DA80\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x800\n"
+                "B       loc_FF96CBB4\n"
+"loc_FF96CB20:\n"
+                "BL      sub_FF96E81C\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x8000\n"
+                "B       loc_FF96CBB4\n"
+"loc_FF96CB30:\n"
+                "BL      sub_FF96EBF8\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x10000\n"
+                "B       loc_FF96CBB4\n"
+"loc_FF96CB40:\n"
+                "BL      sub_FF96EB14\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x20000\n"
+                "B       loc_FF96CBB4\n"
+"loc_FF96CB50:\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF96ECB0\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x40000\n"
+                "B       loc_FF96CBB4\n"
+"loc_FF96CB64:\n"
+                "BL      sub_FF96EFBC\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x80000\n"
+                "B       loc_FF96CBB4\n"
+"loc_FF96CB74:\n"
+                "BL      sub_FF96F034\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x100000\n"
+                "B       loc_FF96CBB4\n"
+"loc_FF96CB84:\n"
+                "BL      sub_FF96F080\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x200000\n"
+                "B       loc_FF96CBB4\n"
+"loc_FF96CB94:\n"
+                "MOV     R0, #1\n"
+                "BL      sub_FF96ECB0\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x400000\n"
+                "B       loc_FF96CBB4\n"
+"loc_FF96CBA8:\n"
+                "BL      sub_FF96F0E8\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x800000\n"
+"loc_FF96CBB4:\n"
+                "LDR     R0, [R3]\n"
+                "BL      sub_FF82072C\n"
+                "B       loc_FF96CBD0\n"
+"loc_FF96CBC0:\n"
+                "MOV     R1, #0x374\n"
+                "LDR     R0, =0xFF96BD0C\n"
+                "ADD     R1, R1, #2\n"
+                "BL      sub_FF813D58\n"
+"loc_FF96CBD0:\n"
+                "LDR     R0, [SP,#0xC-0xC]\n"
+                "BL      sub_FF96BD8C\n"
+"loc_FF96CBD8:\n"
+                "LDR     R3, =0x5D100\n"
+                "MOV     R1, R4\n"
+                "LDR     R0, [R3]\n"
+                "MOV     R2, #0\n"
+                "BL      sub_FF820F34\n"
+                "TST     R0, #1\n"
+                "BEQ     loc_FF96CA28\n"
+                "LDR     R0, =0xFF96BD0C\n"
+                "MOV     R1, #0x2EC\n"
+                "BL      sub_FF813D58\n"
+                "BL      sub_FF82275C\n"
+                "ADD     SP, SP, #4\n"
+                "LDMFD   SP!, {R4,PC}\n"
+	);
+}
+
Index: /trunk/platform/s2is/sub/100e/stubs_entry.S
===================================================================
--- /trunk/platform/s2is/sub/100e/stubs_entry.S	(revision 511)
+++ /trunk/platform/s2is/sub/100e/stubs_entry.S	(revision 511)
@@ -0,0 +1,171 @@
+// !!! THIS FILE IS GENERATED. DO NOT EDIT. !!!
+#include "stubs_asm.h"
+
+// Best match: 79%
+NSTUB(AllocateMemory, 0xff811ba0)
+NSTUB(AllocateUncacheableMemory, 0xff814810)
+// ERROR: Close is not found!
+NSTUB(CreatePhysicalVram, 0xff93e4f4)
+NSTUB(CreateTask, 0xff82239c)
+NSTUB(CreateTaskStrict, 0xff823964)
+NSTUB(DisableDispatch, 0xff82210c)
+// ERROR: DisplayImagePhysicalScreen is not found!
+NSTUB(EnableDispatch, 0xff822198)
+NSTUB(ExecuteEventProcedure, 0xff816ab4)
+NSTUB(ExitTask, 0xff82275c)
+NSTUB(Fclose_Fut, 0xff86fd34)
+NSTUB(Fopen_Fut, 0xff86fcf8)
+NSTUB(Fread_Fut, 0xff86fe18)
+// Best match: 66%
+NSTUB(FreeMemory, 0xff811bac)
+NSTUB(FreeUncacheableMemory, 0xff814844)
+NSTUB(Fseek_Fut, 0xff86ff00)
+NSTUB(Fwrite_Fut, 0xff86fe68)
+NSTUB(GetCurrentAvValue, 0xffaa6cc4)
+// ALT: NSTUB(GetCurrentAvValue, 0xffaa8c78) // 13/0
+NSTUB(GetCurrentTargetDistance, 0xffaa8c20)
+// Best match: 87%
+NSTUB(GetFocusLensSubjectDistance, 0xffa8e96c)
+// ALT: NSTUB(GetFocusLensSubjectDistance, 0xffa8e96c) // 27/4
+// ERROR: GetFocusLensSubjectDistanceFromLens is not found!
+// Best match: 76%
+NSTUB(GetParameterData, 0xff987fe0)
+// ALT: NSTUB(GetParameterData, 0xff987fe0) // 23/7
+// Best match: 71%
+NSTUB(GetPropertyCase, 0xff825d04)
+// Best match: 96%
+NSTUB(GetSystemTime, 0xff814b98)
+// ALT: NSTUB(GetSystemTime, 0xff814b98) // 26/1
+// Best match: 68%
+NSTUB(GetZoomLensCurrentPoint, 0xffa88174)
+// ALT: NSTUB(GetZoomLensCurrentPoint, 0xffa88174) // 20/9
+// Best match: 51%
+NSTUB(GetZoomLensCurrentPosition, 0xffa88188)
+// ALT: NSTUB(GetZoomLensCurrentPosition, 0xffa88188) // 15/14
+NSTUB(IsStrobeChargeCompleted, 0xff912f08)
+// Best match: 96%
+NSTUB(LockMainPower, 0xff9834f0)
+// Best match: 70%
+NSTUB(MakeDirectory, 0xff8775b0)
+// ERROR: Mount_FileSystem is not found!
+// Best match: 96%
+NSTUB(MoveFocusLensToDistance, 0xffaa8eb0)
+// ERROR: MoveZoomLensWithPoint is not found!
+// ERROR: Open is not found!
+// ERROR: PhySw_testgpio is not found!
+NSTUB(ProtectFile, 0xff86f360)
+NSTUB(PutInNdFilter, 0xffaa6cd8)
+// ALT: NSTUB(PutInNdFilter, 0xffaa6d20) // 27/0
+// Best match: 94%
+NSTUB(PutOutNdFilter, 0xffaa7130)
+// ALT: NSTUB(PutOutNdFilter, 0xffaa7130) // 16/1
+// ERROR: Read is not found!
+NSTUB(RefreshPhysicalScreen, 0xff9988dc)
+// ERROR: Remove is not found!
+// Best match: 96%
+NSTUB(SetAutoShutdownTime, 0xff9833e8)
+// Best match: 66%
+NSTUB(SetParameterData, 0xff987fdc)
+// ERROR: SetPropertyCase is not found!
+NSTUB(SleepTask, 0xff8221fc)
+// ALT: NSTUB(SleepTask, 0xff8222b0) // 31/0
+NSTUB(TakeSemaphore, 0xff821b6c)
+// Best match: 96%
+NSTUB(UnlockMainPower, 0xff9835a4)
+NSTUB(Unmount_FileSystem, 0xff8762d4)
+// ERROR: UnsetZoomForMovie is not found!
+// Best match: 96%
+NSTUB(UpdateMBROnFlash, 0xff876480)
+// ERROR: VbattGet is not found!
+// ERROR: Write is not found!
+NSTUB(_log, 0xffae0a40)
+// ALT: NSTUB(_log, 0xffae0a40) // 27/0
+NSTUB(_log10, 0xffae10e8)
+// ALT: NSTUB(_log10, 0xffae10e8) // 27/0
+NSTUB(_pow, 0xffae15d8)
+// ALT: NSTUB(_pow, 0xffae15d8) // 25/0
+NSTUB(_sqrt, 0xffae5924)
+// ALT: NSTUB(_sqrt, 0xffae5924) // 24/0
+NSTUB(chdir, 0xffaf4b80)
+// ALT: NSTUB(chdir, 0xffaf4b80) // 27/0
+NSTUB(close, 0xffaf44c0)
+NSTUB(closedir, 0xffaf0460)
+// ERROR: free is not found!
+NSTUB(ints_disable, 0xff81e254)
+NSTUB(ints_enable, 0xff81e260)
+NSTUB(ioctl, 0xffaf4600)
+NSTUB(iosDevAdd, 0xffaf56e0)
+NSTUB(iosDrvInstall, 0xffaf59a4)
+NSTUB(isalpha, 0xffaea3d4)
+// ALT: NSTUB(isalpha, 0xffaea3d4) // 4/0
+NSTUB(isdigit, 0xffaea404)
+// ALT: NSTUB(isdigit, 0xffaea404) // 4/0
+NSTUB(islower, 0xffaea434)
+// ALT: NSTUB(islower, 0xffaea434) // 4/0
+NSTUB(isspace, 0xffaea47c)
+// ALT: NSTUB(isspace, 0xffaea47c) // 4/0
+NSTUB(isupper, 0xffaea494)
+// ALT: NSTUB(isupper, 0xffaea494) // 4/0
+// ERROR: kbd_p1_f is not found!
+// ERROR: kbd_p1_f_cont is not found!
+// ERROR: kbd_p2_f is not found!
+// Best match: 83%
+NSTUB(kbd_pwr_off, 0xff82b0d4)
+// ALT: NSTUB(kbd_pwr_off, 0xff82b0f0) // 5/1
+// Best match: 55%
+NSTUB(kbd_pwr_on, 0xff9402d8)
+// ALT: NSTUB(kbd_pwr_on, 0xff940304) // 5/4
+// ERROR: kbd_read_keys_r2 is not found!
+// Best match: 93%
+NSTUB(localtime, 0xffaeec54)
+NSTUB(lseek, 0xffaf4604)
+// Best match: 53%
+NSTUB(malloc, 0xffaf7500)
+// ALT: NSTUB(malloc, 0xffaf7500) // 15/13
+NSTUB(memcmp, 0xffaee034)
+// ALT: NSTUB(memcmp, 0xffafc41c) // 9/0
+NSTUB(memcpy, 0xffaee070)
+NSTUB(memset, 0xffaee0e8)
+// Best match: 61%
+NSTUB(mkdir, 0xff8774fc)
+// ALT: NSTUB(mkdir, 0xff8775bc) // 19/12
+NSTUB(open, 0xffaf4b04)
+NSTUB(opendir, 0xffaf0494)
+NSTUB(qsort, 0xffaed894)
+NSTUB(rand, 0xffaed8b8)
+// ALT: NSTUB(rand, 0xffaed8b8) // 8/0
+NSTUB(read, 0xffaf4520)
+NSTUB(readdir, 0xffaf042c)
+NSTUB(rename, 0xffaf4b0c)
+// ALT: NSTUB(rename, 0xffaf4b0c) // 26/0
+NSTUB(rewinddir, 0xffaf0454)
+NSTUB(srand, 0xffaed8dc)
+// ALT: NSTUB(srand, 0xffaed8dc) // 4/0
+NSTUB(stat, 0xffaf0528)
+NSTUB(strcat, 0xffaee108)
+NSTUB(strchr, 0xffaee134)
+NSTUB(strcmp, 0xffaee158)
+NSTUB(strcpy, 0xffaee2ec)
+NSTUB(strlen, 0xffaee450)
+NSTUB(strncmp, 0xffaee4b4)
+NSTUB(strncpy, 0xffaee4f8)
+// ALT: NSTUB(strncpy, 0xffaee4f8) // 24/0
+NSTUB(strpbrk, 0xffaee540)
+NSTUB(strrchr, 0xffaee57c)
+// ALT: NSTUB(strrchr, 0xffaee57c) // 8/0
+NSTUB(strtol, 0xffaedcd0)
+NSTUB(taskCreateHookAdd, 0xffafab80)
+NSTUB(taskDeleteHookAdd, 0xffafaabc)
+// Best match: 82%
+NSTUB(taskIdListGet, 0xffb02664)
+NSTUB(taskLock, 0xffb02d20)
+NSTUB(taskName, 0xffb0255c)
+NSTUB(taskResume, 0xffb02940)
+NSTUB(taskSuspend, 0xffb0276c)
+NSTUB(taskUnlock, 0xffb02dc8)
+NSTUB(time, 0xffaef9a0)
+// ALT: NSTUB(time, 0xffaef9a0) // 25/0
+NSTUB(utime, 0xffaf05bc)
+// ALT: NSTUB(utime, 0xffaf05bc) // 26/0
+NSTUB(vsprintf, 0xffaf1d80)
+NSTUB(write, 0xffaf4590)
Index: /trunk/platform/s2is/sub/100e/stubs_entry_2.S
===================================================================
--- /trunk/platform/s2is/sub/100e/stubs_entry_2.S	(revision 511)
+++ /trunk/platform/s2is/sub/100e/stubs_entry_2.S	(revision 511)
@@ -0,0 +1,42 @@
+#include "stubs_asm.h"
+
+NHSTUB(Close, 0xFF877374)
+NHSTUB(Remove, 0xFF877380)
+NHSTUB(DisplayImagePhysicalScreen, 0xFF93DCB0)
+NHSTUB(free, 0xFFAF750C)
+NHSTUB(Open, 0xFF877368)
+NHSTUB(Read, 0xFF8773D4)
+NHSTUB(Write, 0xFF8773E0)
+NHSTUB(VbattGet, 0xFF82D570)
+NHSTUB(Mount_FileSystem, 0xFF876264)
+NHSTUB(SetParameterData, 0xFF987F0C)
+NHSTUB(GetPropertyCase, 0xFF825D08)
+NHSTUB(SetPropertyCase, 0xFF825C00)
+NHSTUB(GetZoomLensCurrentPosition, 0xFFAA87B8)
+NHSTUB(GetZoomLensCurrentPoint, 0xFFAA87A4)
+NHSTUB(MoveZoomLensWithPoint, 0xFFA87F80)
+NHSTUB(SetZoomActuatorSpeedPercent, 0xFFA880F8)
+
+NHSTUB(kbd_p1_f, 0xFF829470)
+NHSTUB(kbd_p1_f_cont, 0xFF829484)
+NHSTUB(kbd_read_keys_r2, 0xFF829E58)
+NHSTUB(platformsub_kbd_fetch_data, 0xFF829F8C)
+NHSTUB(kbd_p2_f, 0xFF829364)
+
+// null stubs
+NHSTUB(PhySw_testgpio, 0xFF8118C0)
+NHSTUB(UnsetZoomForMovie, 0xFF8118C0)
+
+NHSTUB(UniqueLedOn, 0xFF82EBDC)
+NHSTUB(UniqueLedOff, 0xFF82EC54)
+
+NHSTUB(GetDrive_ClusterSize, 0xFF8767A0)
+NHSTUB(GetDrive_TotalClusters, 0xFF8767FC)
+NHSTUB(GetDrive_FreeClusters, 0xFF876838)
+NHSTUB(GetFocusLensSubjectDistanceFromLens, 0xFFA8EEF4)
+NHSTUB(GetBatteryTemperature, 0xFF82E368)
+NHSTUB(GetCCDTemperature, 0xFF82E354)
+NHSTUB(GetOpticalTemperature, 0xFF82E340)
+NHSTUB(PT_PlaySound, 0xFF97BD40)
+NHSTUB(EnterToCompensationEVF, 0xff968150) 
+NHSTUB(ExitFromCompensationEVF, 0xff9681a4) 
Index: /trunk/platform/s2is/sub/100e/boot.c
===================================================================
--- /trunk/platform/s2is/sub/100e/boot.c	(revision 511)
+++ /trunk/platform/s2is/sub/100e/boot.c	(revision 511)
@@ -0,0 +1,238 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+const long new_sa = MEMISOSTART + MEMISOSIZE;
+
+/* Ours stuff */
+extern long wrs_kernel_bss_start;
+extern long wrs_kernel_bss_end;
+extern void createHook (void *pNewTcb);
+extern void deleteHook (void *pTcb);
+
+void boot();
+
+/* "relocated" functions */
+void __attribute__((naked,noinline)) h_usrInit();
+void __attribute__((naked,noinline)) h_usrKernelInit();
+void __attribute__((naked,noinline)) h_usrRoot();
+
+extern void mykbd_task_proceed_2();
+
+void __attribute__((naked,noinline)) h_kbd_p2_f()
+{
+    asm volatile (
+                 "LDR     R4, =0x10390\n"
+                 "LDR     R1, [R4,#0x30]\n"
+                 "TST     R1, #0x8000\n"
+                 "BEQ     loc_FF829394\n"
+                 "MOV     R1, #0\n"
+                 "MOV     R0, #0xF\n"
+                 "MOV     R2, #0x8000\n"
+                 "BL      sub_FF829978\n"
+                 "LDR     R3, [R4,#0x30]\n"
+                 "BIC     R3, R3, #0x8000\n"
+                 "STR     R3, [R4,#0x30]\n"
+                 "MOV     R1, R3\n"
+    "loc_FF829394:\n"
+                 "TST     R1, #1\n"
+                 "BEQ     loc_FF8293BC\n"
+                 "MOV     R0, #0\n"
+                 "MOV     R1, R0\n"
+                 "MOV     R2, R5\n"
+                 "BL      sub_FF829978\n"
+                 "LDR     R3, [R4,#0x30]\n"
+                 "BIC     R3, R3, #1\n"
+                 "STR     R3, [R4,#0x30]\n"
+                 "MOV     R1, R3\n"
+    "loc_FF8293BC:\n"
+                 "TST     R1, #2\n"
+                 "BEQ     loc_FF8293E4\n"
+                 "MOV     R1, #0\n"
+                 "MOV     R0, R5\n"
+                 "MOV     R2, #2\n"
+                 "BL      sub_FF829978\n"
+                 "LDR     R3, [R4,#0x30]\n"
+                 "BIC     R3, R3, #2\n"
+                 "STR     R3, [R4,#0x30]\n"
+                 "MOV     R1, R3\n"
+    "loc_FF8293E4:\n"
+                 "LDR     R3, [R4,#0x34]\n"
+                 "LDR     R2, [R4,#0x38]\n"
+                 "ADD     R3, R1, R3\n"
+                 "CMN     R3, R2\n"
+                 "BEQ     loc_FF8293FC\n"
+                 "BL      sub_FF8299D8\n"
+    "loc_FF8293FC:\n"
+                 "LDR     R3, =0x1FC0\n"
+                 "LDR     R1, [R3]\n"
+                 "CMP     R1, #1\n"
+                 "BNE     loc_FF829418\n"
+                 "MOV     R0, #0x28\n"
+                 "MOV     R2, #0x100\n"
+                 "BL      sub_FF829978\n"
+    "loc_FF829418:\n"
+                 "LDR     R3, =0x1038C\n"
+                 "LDR     R0, [R3]\n"
+                 "CMP     R0, #1\n"
+                 "BNE     loc_FF829440\n"
+                 "MOV     R3, #0x30\n"
+                 "STRH    R3, [SP,#2]\n"
+                 "MOV     R1, R6\n"
+                 "LDR     R3, =0x103F0\n"
+                 "MOV     LR, PC\n"
+                 "LDR     PC, [R3]\n"
+    "loc_FF829440:\n"
+                 "BL      sub_FF82A37C\n"
+                 "B       mykbd_task_proceed_2\n"
+    );
+}
+
+
+void boot()
+{
+    long *canon_data_src = (void*)0xFFB092A0;
+    long *canon_data_dst = (void*)0x1900;
+    long canon_data_len = 0xDBB0;
+    long *canon_bss_start = (void*)0xF4B0; // just after data
+    long canon_bss_len = 0x6EF50 - 0xF4B0;
+    long i;
+
+    asm volatile (
+	"MRC     p15, 0, R0,c1,c0\n"
+	"ORR     R0, R0, #0x1000\n"
+	"ORR     R0, R0, #4\n"
+	"ORR     R0, R0, #1\n"
+	"MCR     p15, 0, R0,c1,c0\n"
+    :::"r0");
+
+
+    for(i=0;i<canon_data_len/4;i++)
+	canon_data_dst[i]=canon_data_src[i];
+
+    for(i=0;i<canon_bss_len/4;i++)
+	canon_bss_start[i]=0;
+
+    asm volatile (
+	"MRC     p15, 0, R0,c1,c0\n"
+	"ORR     R0, R0, #0x1000\n"
+	"BIC     R0, R0, #4\n"
+	"ORR     R0, R0, #1\n"
+	"MCR     p15, 0, R0,c1,c0\n"
+    :::"r0");
+
+    h_usrInit();
+}
+
+
+void h_usrInit()
+{
+    asm volatile (
+	"STR	LR, [SP,#-4]!\n"
+	"BL	sub_FF811A40\n"
+	"MOV	R0, #2\n"
+	"MOV	R1, R0\n"
+	"BL	sub_FFAEF9E0\n"
+	"BL	sub_FFADC0B8\n"
+	"BL	sub_FF811298\n"
+	"BL	sub_FF811800\n"
+	"LDR	LR, [SP],#4\n"
+	"B	h_usrKernelInit\n"
+    );
+}
+
+void  h_usrKernelInit()
+{
+    asm volatile (
+        "STMFD   SP!, {R4,LR}\n"
+        "SUB     SP, SP, #8\n"
+        "BL      sub_FFAEFEE0\n"
+        "BL      sub_FFB026EC\n"
+        "LDR     R3, =0xE8E4\n"
+        "LDR     R2, =0x6A2C0\n"
+        "LDR     R1, [R3]\n"
+        "LDR     R0, =0x6E910\n"
+        "MOV     R3, #0x100\n"
+        "BL      sub_FFAFE01C\n"
+        "LDR     R3, =0xE8A4\n"
+        "LDR     R0, =0xECC4\n"
+        "LDR     R1, [R3]\n"
+        "BL      sub_FFAFE01C\n"
+        "LDR     R3, =0xE960\n"
+        "LDR     R0, =0x6E8E4\n"
+        "LDR     R1, [R3]\n"
+        "BL      sub_FFAFE01C\n"
+        "BL      sub_FFB0726C\n"
+        "BL      sub_FF811384\n"
+        "MOV     R4, #0\n"
+        "MOV     R3, R0\n"
+        "MOV     R12, #0x800\n"
+        "LDR     R0, =h_usrRoot\n"
+        "MOV     R1, #0x4000\n"
+    );
+//        "LDR     R2, =0x9EF50\n"	// 0x6EF50 + 0x30000
+    asm volatile (
+        "LDR     R2, =new_sa\n"
+        "LDR     R2, [R2]\n"
+    );
+    asm volatile (
+        "STR     R12, [SP]\n"
+        "STR     R4, [SP,#4]\n"
+        "BL      sub_FFAFF92C\n"
+        "ADD     SP, SP, #8\n"
+        "LDMFD   SP!, {R4,PC}\n"
+    );
+}
+
+static long drv_struct[16];
+ 
+static long dh_err()
+{
+    return -1;
+}
+
+static void drv_self_hide()
+{
+    long drvnum;
+    
+    drvnum = _iosDrvInstall(dh_err,dh_err,dh_err,dh_err,dh_err,dh_err,dh_err);
+    if (drvnum >= 0)
+	_iosDevAdd(drv_struct, "A/DISKBOOT.BIN", drvnum);
+}
+
+
+void  h_usrRoot()
+{
+    asm volatile (
+        "STMFD   SP!, {R4,R5,LR}\n"
+        "MOV     R5, R0\n"
+        "MOV     R4, R1\n"
+        "BL      sub_FF811AA8\n"
+        "MOV     R1, R4\n"
+        "MOV     R0, R5\n"
+        "BL      sub_FFAF605C\n"
+        "MOV     R1, R4\n"
+        "MOV     R0, R5\n"
+        "BL      sub_FFAF6AD4\n"
+        "BL      sub_FF8118C0\n"
+        "BL      sub_FF8117DC\n"
+        "MOV     R0, #0x32\n"
+        "BL      sub_FFAF8A78\n"
+        "BL      sub_FF811AEC\n"
+        "BL      sub_FF811ACC\n"
+        "BL      sub_FF811B18\n"
+        "BL      sub_FFAF8338\n"
+        "BL      sub_FF811A9C\n"
+    );
+
+    _taskCreateHookAdd(createHook);
+    _taskDeleteHookAdd(deleteHook);
+
+    drv_self_hide();
+
+    asm volatile (
+        "LDMFD   SP!, {R4,R5,LR}\n"
+        "B       sub_FF811444\n"
+    );
+}
+
Index: /trunk/platform/s2is/sub/100e/stubs_min.S
===================================================================
--- /trunk/platform/s2is/sub/100e/stubs_min.S	(revision 511)
+++ /trunk/platform/s2is/sub/100e/stubs_min.S	(revision 511)
@@ -0,0 +1,14 @@
+#include "stubs_asm.h"
+
+DEF(physw_status, 0x103C0)
+DEF(physw_run, 0x1FC0)
+DEF(playrec_mode, 0x569C)
+DEF(kbd_const_1, 0x10464)
+DEF(led_table, 0x105F0)
+DEF(zoom_busy, 0x64460)
+DEF(focus_busy, 0x645D4)
+DEF(FlashParamsTable,0xFF9858A0)
+DEF(canon_menu_active,0x7BA0)
+DEF(canon_shoot_menu_active,0x6C91)
+DEF(recreview_hold, 0x60FB0)
+DEF(movie_status,0x5C95C)
Index: /trunk/platform/s2is/sub/100e/makefile.inc
===================================================================
--- /trunk/platform/s2is/sub/100e/makefile.inc	(revision 511)
+++ /trunk/platform/s2is/sub/100e/makefile.inc	(revision 511)
@@ -0,0 +1,15 @@
+#0x30F0
+PLATFORMID=12528
+
+PLATFORMOS=vxworks
+
+MEMBASEADDR=0x1900
+RESTARTSTART=0x50000
+MEMISOSTART=0x6EF50
+MEMISOSIZE=0x55000
+ROMBASEADDR=0xff810000
+
+TARGET_PRIMARY=$(topdir)platform/$(PLATFORM)/sub/$(PLATFORMSUB)/PRIMARY.BIN
+
+PLFLAGS=-DMEMBASEADDR=$(MEMBASEADDR) -DMEMISOSTART=$(MEMISOSTART) -DMEMISOSIZE=$(MEMISOSIZE)
+PLFLAGS+=-DRESTARTSTART=$(RESTARTSTART)
Index: /trunk/platform/s2is/sub/100e/stubs_asm.h
===================================================================
--- /trunk/platform/s2is/sub/100e/stubs_asm.h	(revision 511)
+++ /trunk/platform/s2is/sub/100e/stubs_asm.h	(revision 511)
@@ -0,0 +1,20 @@
+    .text
+
+#define DEF(n,a) \
+    .globl n; n = a
+
+#define NSTUB(name, addr)\
+    .globl _##name ;\
+    .weak _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define NHSTUB(name, addr)\
+    .globl _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define STUB(addr)\
+    .globl sub_ ## addr ;\
+    sub_ ## addr: ;\
+	ldr  pc, =0x ## addr
Index: /trunk/platform/s2is/sub/100e/lib.c
===================================================================
--- /trunk/platform/s2is/sub/100e/lib.c	(revision 511)
+++ /trunk/platform/s2is/sub/100e/lib.c	(revision 511)
@@ -0,0 +1,65 @@
+#include "platform.h"
+
+void *hook_raw_fptr()
+{
+    return (void*)0x2F490;
+}
+
+void *hook_raw_ret_addr()
+{
+    return (void*)0xFF8D8BDC;
+}
+
+char *hook_raw_image_addr()
+{
+    return (char*)(0x10595D54);
+}
+
+long hook_raw_size()
+{
+    return 0x644C40;
+}
+
+void *vid_get_viewport_live_fb()
+{
+    return (void*)0x0;
+}
+
+void *vid_get_bitmap_fb()
+{
+    return (void*)0x103CEB20;
+}
+
+void *vid_get_viewport_fb()
+{
+    return (void*)0x105F84F0; // 0x104B6C20;
+}
+
+void *vid_get_viewport_fb_d()
+{
+    return (void*)(*(int*)0x5BAEC);
+}
+
+long vid_get_bitmap_screen_width()
+{
+    return 360;
+}
+
+long vid_get_bitmap_screen_height()
+{
+    return 240;
+}
+
+long vid_get_viewport_height()
+{
+    return 240;
+}
+char *camera_jpeg_count_str()
+{
+    return (char*)0x63518;
+}
+
+long vid_get_bitmap_buffer_width() { return 360; }
+
+long vid_get_bitmap_buffer_height() { return 240; }
+
Index: /trunk/platform/s2is/sub/100e/movie_rec.c
===================================================================
--- /trunk/platform/s2is/sub/100e/movie_rec.c	(revision 511)
+++ /trunk/platform/s2is/sub/100e/movie_rec.c	(revision 511)
@@ -0,0 +1,661 @@
+#include "conf.h"
+
+int *video_quality = &conf.video_quality;
+int *video_mode    = &conf.video_mode;
+
+long def_table1[56]={
+0x10000,0xC000,0x5800, 0x2000, 0x1C6A, 0x1550,0x9C5,  0x38D,  0x3C45, 0x2D34, 0x14B8, 0x788,  0x5F60, 0x4788,
+0x20C9, 0xBE1, 0x8661, 0x64C9, 0x2E31, 0x10CB,0xB21A, 0x8594, 0x3D39, 0x1642, 0xE249, 0xA9B8, 0x4DC9, 0x1C48,
+0x117D2,0xD1DF,0x6030, 0x22F9, 0x153D5,0xFEE1,0x74D1, 0x2A79, 0x195F8,0x1307C,0x8B8D, 0x32AA, 0x1E01C,0x16817,
+0xA509, 0x3C01,0x2328E,0x1A5ED,0xC160, 0x4637,0x28C99,0x1E975,0xE054, 0x5190, 0x2F08B,0x2346B,0x102AF,0x5E0E
+};
+
+long def_table2[12]={0xE666,0xACCD,0x4F33,0x1CCD,-0x170A,-0x1148,-0x7EB,-0x2E1,-0x2BC6,-0x20D5,-0xF0C,-0x579};
+
+long table1[56], table2[12];
+
+void change_video_tables(int a, int b){
+ int i;
+ for (i=0;i<56;i++) table1[i]=(def_table1[i]*a)/b;
+ for (i=0;i<12;i++) table2[i]=(def_table2[i]*a)/b;
+}
+
+long CompressionRateTable[]={0x60, 0x5D, 0x5A, 0x57, 0x54, 0x51, 0x4D, 0x48, 0x42, 0x3B, 0x32, 0x29, 0x22, 0x1D, 0x17, 0x14, 0x10, 0xE, 0xB, 9, 7, 6, 5, 4, 3, 2, 1};
+
+
+void __attribute__((naked,noinline)) movie_record_task(){
+ asm volatile(
+                "STMFD   SP!, {R4,LR}\n"    
+                "SUB     SP, SP, #4\n"      
+                "MOV     R4, SP\n"          
+                "B       loc_FF953F78\n"    
+"loc_FF953EA4:\n"                            
+                "LDR     R3, =0x5C940\n"    
+                "LDR     R2, [R3]\n"        
+                "CMP     R2, #0\n"          
+                "BNE     loc_FF953F40\n"    
+                "SUB     R3, R12, #1\n"     
+                "CMP     R3, #0xA\n"        
+                "LDRLS   PC, [PC,R3,LSL#2]\n" 
+                "B       loc_FF953F40\n"    
+                ".long loc_FF953EF0\n"
+                ".long loc_FF953EF8\n"
+                ".long loc_FF953F10\n"
+                ".long loc_FF953F18\n"
+                ".long loc_FF953F20\n"
+                ".long loc_FF953F00\n"
+                ".long loc_FF953F28\n"
+                ".long loc_FF953F08\n"
+                ".long loc_FF953F40\n"
+                ".long loc_FF953F38\n"
+                ".long loc_FF953F30\n"
+"loc_FF953EF0:\n"                            
+                                        
+                "BL      sub_FF95400C\n"    
+                "B       loc_FF953F3C\n"    
+"loc_FF953EF8:\n"                            
+                                        
+                "BL      sub_FF954260\n"   
+                "B       loc_FF953F3C\n"    
+"loc_FF953F00:\n"                            
+                                        
+                "BL      sub_FF954714_my\n"    //---------------->
+                "B       loc_FF953F3C\n"    
+"loc_FF953F08:\n"                            
+                                        
+                "BL      sub_FF954BAC\n"    
+                "B       loc_FF953F3C\n"    
+"loc_FF953F10:\n"                            
+                                        
+                "BL      sub_FF95497C\n"    
+                "B       loc_FF953F3C\n"    
+"loc_FF953F18:\n"                            
+                                        
+                "BL      sub_FF954EC4\n"    
+                "B       loc_FF953F3C\n"    
+"loc_FF953F20:\n"                            
+                                        
+                "BL      sub_FF955088\n"    
+                "B       loc_FF953F3C\n"    
+"loc_FF953F28:\n"                            
+                                        
+                "BL      sub_FF954D78\n"    
+                "B       loc_FF953F3C\n"    
+"loc_FF953F30:\n"                            
+                                        
+                "BL      sub_FF954E58\n"    
+                "B       loc_FF953F3C\n"    
+"loc_FF953F38:\n"                            
+                                        
+                "BL      sub_FF9549CC\n"    
+"loc_FF953F3C:\n"                            
+                                        
+                "LDR     R1, [SP]\n"        
+"loc_FF953F40:\n"                            
+                                        
+                "LDR     R3, [R1]\n"        
+                "CMP     R3, #9\n"          
+                "BNE     loc_FF953F58\n"    
+                "MOV     R0, R1\n"          
+                "BL      sub_FF955218\n"      
+                "LDR     R1, [SP]\n"        
+"loc_FF953F58:\n"                            
+                "LDR     R3, =0x5C870\n"    
+                "MOV     R2, #0\n"          
+                "LDR     R0, [R3]\n"        
+                "STR     R2, [R1]\n"        
+                "BL      sub_FF82134C\n" 
+                "LDR     R3, =0x5CA10\n"    
+                "LDR     R0, [R3]\n"        
+                "BL      sub_FF821D54\n"   
+"loc_FF953F78:\n"                            
+                "LDR     R3, =0x5C86C\n"    
+                "MOV     R1, R4\n"          
+                "LDR     R0, [R3]\n"        
+                "MOV     R2, #0\n"          
+                "BL      sub_FF820F34\n" 
+                "LDR     R3, =0x5CA10\n"    
+                "MOV     R1, #0\n"          
+                "LDR     R0, [R3]\n"        
+                "BL      sub_FF821B6C\n"   
+                "LDR     R0, [SP]\n"        
+                "LDR     R12, [R0]\n"       
+                "CMP     R12, #0xC\n"       
+                "MOV     R1, R0\n"          
+                "BNE     loc_FF953EA4\n"    
+                "LDR     R3, =0x5C864\n"    
+                "LDR     R0, [R3]\n"        
+                "BL      sub_FF821D54\n"   
+                "BL      sub_FF82275C\n"        
+                "ADD     SP, SP, #4\n"      
+                "LDMFD   SP!, {R4,PC}\n"    
+ );
+}
+
+
+void __attribute__((naked,noinline)) sub_FF954714_my(){
+ asm volatile(
+                "STMFD   SP!, {R4-R8,LR}\n"                     
+                "LDR     R5, =0x5C95C\n"                        
+                "SUB     SP, SP, #0x1C\n"                       
+                "LDR     R3, [R5]\n"                            
+                "CMP     R3, #3\n"                              
+                "MOV     R4, R0\n"                              
+                "MOVEQ   R3, #4\n"                              
+                "STREQ   R3, [R5]\n"                            
+                "LDR     R3, =0x5CA04\n"                        
+                "MOV     LR, PC\n"                              
+                "LDR     PC, [R3]\n"                            
+                "LDR     R2, [R5]\n"                            
+                "CMP     R2, #4\n"                              
+                "BNE     loc_FF9548AC\n"                        
+                "ADD     R0, SP, #0x18\n"                       
+                "BL      sub_FF956A80_my\n"   //------------------->                    
+                "CMP     R0, #0\n"                              
+                "BNE     loc_FF954784\n"                        
+                "LDR     R3, =0x5C948\n"                        
+                "LDR     R2, [R3]\n"                            
+                "CMP     R2, #1\n"                              
+                "BNE     loc_FF9547A0\n"                        
+                "LDR     R2, =0x5C998\n"                        
+                "LDR     R1, =0x5C970\n"                        
+                "LDR     R12, [R2]\n"                           
+                "LDR     R3, [R1]\n"                            
+                "CMP     R12, R3\n"                             
+                "BCC     loc_FF9547A0\n"                        
+"loc_FF954784:\n"                                               
+                "BL      sub_FF9548F4\n"                        
+                "LDR     R3, =0x5654\n"                         
+                "LDR     R0, [R3]\n"                            
+                "BL      sub_FF8319D0\n"                        
+                "MOV     R3, #5\n"                              
+                "STR     R3, [R5]\n"                            
+                "B       loc_FF9548AC\n"                        
+"loc_FF9547A0:\n"                                               
+                                                            
+                "LDR     R0, [R4,#4]\n"                         
+                "LDR     R5, [R4,#0xC]\n"                       
+                "LDR     R3, =0x5C9A0\n"                        
+                "LDR     R4, [R4,#8]\n"                         
+                "LDR     R8, =0x5C9AC\n"                        
+                "LDR     R6, =0x5C94C\n"                        
+                "ADD     R12, SP, #0x14\n"                      
+                "ADD     LR, SP, #0x10\n"                       
+                "MOV     R7, #1\n"                              
+                "LDR     R2, [R3]\n"                            
+                "LDR     R1, [SP,#0x18]\n"                      
+                "STMEA   SP, {R4,R5,R12,LR}\n"                  
+                "LDR     R3, [R8]\n"                            
+                "STR     R7, [R6]\n"                            
+                "BL      sub_FF8A5390\n"                        
+                "LDR     R3, =0x5C864\n"                        
+                "MOV     R1, #0x3E8\n"                          
+                "LDR     R0, [R3]\n"                            
+                "BL      sub_FF821B6C\n"                       
+                "CMP     R0, #9\n"                              
+                "BNE     loc_FF954804\n"                        
+                "BL      sub_FF9571BC\n"                        
+                "LDR     R3, =0x5C95C\n"                        
+                "LDR     R0, =0xFF9546FC\n"                 
+                "B       loc_FF95481C\n"                        
+"loc_FF954804:\n"                                               
+                "LDR     R5, [SP,#0x10]\n"                      
+                "CMP     R5, #0\n"                              
+                "BEQ     loc_FF954828\n"                        
+                "BL      sub_FF9571BC\n"                        
+                "LDR     R3, =0x5C95C\n"                        
+                "LDR     R0, =0xFF954708\n"                 
+"loc_FF95481C:\n"                                               
+                "STR     R7, [R3]\n"                            
+                "BL      sub_FF97C2DC\n"                        
+                "B       loc_FF9548AC\n"                        
+"loc_FF954828:\n"                                               
+                "BL      sub_FF8A543C\n"                
+                "LDR     R0, [SP,#0x18]\n"                      
+                "LDR     R1, [SP,#0x14]\n"                      
+                "BL      sub_FF956ED4\n"                        
+                "LDR     R4, =0x5C998\n"                        
+                "LDR     R3, [R4]\n"                            
+                "ADD     R3, R3, #1\n"                          
+                "LDR     R0, [SP,#0x14]\n"                      
+                "MOV     R1, R8\n"                              
+                "STR     R3, [R4]\n"                            
+                "MOV     R2, R5\n"                              
+                "BL      sub_FF955964_my\n"    //---------------->                    
+                "LDR     R3, =0x5C984\n"                        
+                "LDR     R4, [R4]\n"                            
+                "LDR     R1, [R3]\n"                            
+                "MOV     R0, R4\n"                              
+                "BL      sub_FFAEA214\n"                           
+                "CMP     R0, #0\n"                              
+                "BEQ     loc_FF954888\n"                        
+                "LDR     R6, =0x5C950\n"                        
+                "LDR     R3, [R6]\n"                            
+                "CMP     R3, #1\n"                              
+                "BNE     loc_FF9548A0\n"                        
+                "B       loc_FF95488C\n"                        
+"loc_FF954888:\n"                                               
+                "LDR     R6, =0x5C950\n"                        
+"loc_FF95488C:\n"                                               
+                "MOV     R0, R4\n"                              
+                "LDR     R3, =0x5C9E0\n"                        
+                "MOV     LR, PC\n"                              
+                "LDR     PC, [R3]\n"                            
+                "STR     R5, [R6]\n"                            
+"loc_FF9548A0:\n"                                               
+                "LDR     R2, =0x5C94C\n"                        
+                "MOV     R3, #0\n"                              
+                "STR     R3, [R2]\n"                            
+"loc_FF9548AC:\n"                                               
+                                                            
+                "ADD     SP, SP, #0x1C\n"                       
+                "LDMFD   SP!, {R4-R8,PC}\n"                     
+
+ );
+}
+
+
+void __attribute__((naked,noinline)) sub_FF956A80_my(){
+ asm volatile(
+                "STMFD   SP!, {R4-R11,LR}\n"                    
+                "LDR     R12, =0x5CD00\n"                       
+                "LDR     R3, =0x5CD18\n"                        
+                "SUB     SP, SP, #8\n"                          
+                "LDR     R1, [R3]\n"                            
+                "LDR     R2, [R12]\n"                           
+                "LDR     R3, =0x5CD9C\n"                        
+                "ADD     R7, R2, #1\n"                          
+                "LDR     R3, [R3]\n"                            
+                "CMP     R7, R1\n"                              
+                "STR     R7, [R12]\n"                           
+                "MOV     R11, R0\n"                             
+                "STR     R3, [SP,#4]\n"                         
+                "MOVHI   R3, #0\n"                              
+                "STRHI   R3, [R11]\n"                           
+                "MOVHI   R0, #0x80000001\n"                     
+                "BHI     loc_FF956E84\n"                        
+                "LDR     R3, =0x5CD80\n"                        
+                "LDR     R4, [R3]\n"                            
+                "MOV     R0, R7\n"                              
+                "MOV     R1, R4\n"                              
+                "BL      sub_FFAEA214\n"                           
+                "CMP     R0, #1\n"                              
+                "BNE     loc_FF956D18\n"                        
+                "LDR     R3, =0x5CDA0\n"                        
+                "LDR     R1, =0x5CDAC\n"                        
+                "LDR     R0, =0x5CCE8\n"                        
+                "LDR     R10, [R3]\n"                           
+                "LDR     R2, [R1]\n"                            
+                "LDR     R5, [R0]\n"                            
+                "ADD     R2, R10, R2\n"                         
+                "CMP     R2, R5\n"                              
+                "BNE     loc_FF956B34\n"                        
+                "MOV     R1, R4\n"                              
+                "MOV     R0, R7\n"                              
+                "BL      sub_FFAE9B84\n"                           
+                "LDR     R2, =0xAAAAAAAB\n"                     
+                "ADD     R0, R0, #1\n"                          
+                "UMULL   R1, R3, R2, R0\n"                      
+                "MOV     R3, R3,LSR#1\n"                        
+                "ADD     R3, R3, R3,LSL#1\n"                    
+                "LDR     R4, =0x5CCF0\n"                        
+                "RSB     R0, R3, R0\n"                          
+                "STR     R10, [R4,R0,LSL#2]\n"                  
+                "B       loc_FF956B60\n"                        
+"loc_FF956B34:\n"                                               
+                "MOV     R1, R4\n"                              
+                "MOV     R0, R7\n"                              
+                "BL      sub_FFAE9B84\n"                           
+                "LDR     R2, =0xAAAAAAAB\n"                     
+                "ADD     R0, R0, #1\n"                          
+                "UMULL   R1, R3, R2, R0\n"                      
+                "MOV     R3, R3,LSR#1\n"                        
+                "ADD     R3, R3, R3,LSL#1\n"                    
+                "LDR     R4, =0x5CCF0\n"                        
+                "RSB     R0, R3, R0\n"                          
+                "STR     R5, [R4,R0,LSL#2]\n"                   
+"loc_FF956B60:\n"                                               
+                "LDR     R3, =0x5CD00\n"                        
+                "LDR     R2, =0x5CD80\n"                        
+                "LDR     R0, [R3]\n"                            
+                "LDR     R1, [R2]\n"                            
+                "BL      sub_FFAE9B84\n"                           
+                "LDR     R2, =0xAAAAAAAB\n"                     
+                "ADD     R0, R0, #1\n"                          
+                "UMULL   R1, R3, R2, R0\n"                      
+                "MOV     R3, R3,LSR#1\n"                        
+                "ADD     R3, R3, R3,LSL#1\n"                    
+                "RSB     R0, R3, R0\n"                          
+                "LDR     R3, =0x5CCE4\n"                        
+                "LDR     R12, [R4,R0,LSL#2]\n"                  
+                "LDR     R2, [R3]\n"                            
+                "CMP     R12, R2\n"                             
+                "BHI     loc_FF956BBC\n"                        
+                "LDR     R4, =0x5CD38\n"                        
+                "LDR     R3, [R4]\n"                            
+                "ADD     R3, R12, R3\n"                         
+                "ADD     R3, R3, #8\n"                          
+                "CMP     R2, R3\n"                              
+                "BCS     loc_FF956BC0\n"                        
+                "B       loc_FF956D94\n"                        
+"loc_FF956BBC:\n"                                               
+                "LDR     R4, =0x5CD38\n"                        
+"loc_FF956BC0:\n"                                               
+                "LDR     R2, =0x5CDA0\n"                        
+                "LDR     R1, =0x5CDAC\n"                        
+                "LDR     R0, [R4]\n"                            
+                "LDR     R3, [R1]\n"                            
+                "LDR     LR, [R2]\n"                            
+                "ADD     R0, R12, R0\n"                         
+                "ADD     R2, LR, R3\n"                          
+                "ADD     R1, R0, #8\n"                          
+                "CMP     R1, R2\n"                              
+                "BLS     loc_FF956C10\n"                        
+                "LDR     R3, =0x5CCE4\n"                        
+                "RSB     R2, R2, R0\n"                          
+                "ADD     R0, R2, #8\n"                          
+                "LDR     R1, [R3]\n"                            
+                "ADD     R2, LR, R0\n"                          
+                "CMP     R1, R2\n"                              
+                "BCC     loc_FF956D94\n"                        
+                "LDR     R3, =0x5CCE8\n"                        
+                "STR     R2, [R3]\n"                            
+                "B       loc_FF956C18\n"                        
+"loc_FF956C10:\n"                                               
+                "LDR     R3, =0x5CCE8\n"                        
+                "STR     R1, [R3]\n"                            
+"loc_FF956C18:\n"                                               
+                "LDR     R3, [R4]\n"                            
+                "LDR     R12, =0x5CD50\n"                       
+                "ADD     R3, R3, #0x18\n"                       
+                "LDR     R2, [R12,#4]\n"                        
+                "MOV     R0, R3\n"                              
+                "MOV     R1, #0\n"                              
+                "CMP     R1, R2\n"                              
+                "BHI     loc_FF956DD4\n"                        
+                "BNE     loc_FF956C48\n"                        
+                "LDR     R3, [R12]\n"                           
+                "CMP     R0, R3\n"                              
+                "BHI     loc_FF956DD4\n"                        
+"loc_FF956C48:\n"                                               
+                "LDR     R4, [R4]\n"                            
+                "LDR     LR, =0x5CD58\n"                        
+                "STR     R4, [SP]\n"                            
+                "LDR     R12, =0x5CD50\n"                       
+                "LDR     R3, =0x5CD00\n"                        
+                "LDMIA   LR, {R7,R8}\n"                         
+                "LDMIA   R12, {R5,R6}\n"                        
+                "LDR     R10, [R3]\n"                           
+                "LDR     R2, =0x5CD80\n"                        
+                "MOV     R3, R4\n"                              
+                "MOV     R4, #0\n"                              
+                "ADDS    R7, R7, R3\n"                          
+                "ADC     R8, R8, R4\n"                          
+                "LDR     R9, [R2]\n"                            
+                "SUBS    R5, R5, R3\n"                          
+                "SBC     R6, R6, R4\n"                          
+                "MVN     R2, #0\n"                              
+                "MVN     R1, #0x17\n"                           
+                "ADDS    R5, R5, R1\n"                          
+                "MOV     R4, #0\n"                              
+                "MOV     R3, #0x18\n"                           
+                "ADC     R6, R6, R2\n"                          
+                "ADDS    R7, R7, R3\n"                          
+                "ADC     R8, R8, R4\n"                          
+                "STMIA   R12, {R5,R6}\n"                        
+                "SUB     R0, R10, #1\n"                         
+                "MOV     R1, R9\n"                              
+                "STMIA   LR, {R7,R8}\n"                         
+                "BL      sub_FFAE9B84\n"                           
+                "CMP     R10, #1\n"                             
+                "MLA     R0, R9, R0, R0\n"                      
+                "BEQ     loc_FF956D18\n"                        
+                "LDR     R1, [SP,#4]\n"                         
+                "SUB     R3, R0, #1\n"                          
+                "MOV     R3, R3,LSL#4\n"                        
+                "ADD     R4, R1, #0x10\n"                       
+                "ADD     R5, R1, #0x14\n"                       
+                "LDR     R1, [R5,R3]\n"                         
+                "LDR     R2, [R4,R3]\n"                         
+                "MOV     R3, R0,LSL#4\n"                        
+                "LDR     R0, [SP,#4]\n"                         
+                "ADD     R2, R2, R1\n"                          
+                "LDR     LR, =0x62773130\n"                     
+                "ADD     R1, R0, #8\n"                          
+                "ADD     R12, R0, #0xC\n"                       
+                "ADD     R2, R2, #8\n"                          
+                "MOV     R0, #0\n"                              
+                "STR     LR, [R1,R3]\n"                         
+                "STR     R0, [R12,R3]\n"                        
+                "STR     R2, [R4,R3]\n"                         
+                "LDR     R1, [SP]\n"                            
+                "STR     R1, [R5,R3]\n"                         
+"loc_FF956D18:\n"                                               
+                                                            
+                "LDR     R2, =0x5CCE8\n"                        
+                "LDR     R3, [R2]\n"                            
+                "ADD     R1, R3, #8\n"                          
+                "STR     R1, [R11]\n"                           
+                "LDR     R0, =0x5CCE4\n"                        
+                "LDR     R2, [R0]\n"                            
+                "CMP     R3, R2\n"                              
+                "BHI     loc_FF956D50\n"                        
+                "LDR     LR, =0x5CD48\n"                        
+                "LDR     R3, [LR]\n"                            
+                "ADD     R3, R1, R3\n"                          
+                "CMP     R2, R3\n"                              
+                "BCS     loc_FF956D54\n"                        
+                "B       loc_FF956D94\n"                        
+"loc_FF956D50:\n"                                               
+                "LDR     LR, =0x5CD48\n"                        
+"loc_FF956D54:\n"                                               
+                "LDR     R3, =0x5CDA0\n"                        
+                "LDR     R2, =0x5CDAC\n"                        
+                "LDR     R12, [R3]\n"                           
+                "LDR     R0, [R2]\n"                            
+                "LDR     R1, [R11]\n"                           
+                "LDR     R3, [LR]\n"                            
+                "ADD     R2, R1, R3\n"                          
+                "ADD     R1, R12, R0\n"                         
+                "CMP     R2, R1\n"                              
+                "BLS     loc_FF956DA4\n"                        
+                "RSB     R0, R1, R2\n"                          
+                "LDR     R1, =0x5CCE4\n"                        
+                "LDR     R2, [R1]\n"                            
+                "ADD     R3, R12, R0\n"                         
+                "CMP     R2, R3\n"                              
+                "BCS     loc_FF956DA4\n"                        
+"loc_FF956D94:\n"                                               
+                                                            
+                "MOV     R3, #0\n"                              
+                "STR     R3, [R11]\n"                           
+                "MOV     R0, #0x80000003\n"                     
+                "B       loc_FF956E84\n"                        
+"loc_FF956DA4:\n"                                               
+                                                            
+                "LDR     R3, [LR]\n"                            
+                "LDR     R12, =0x5CD50\n"                       
+                "ADD     R3, R3, #0x18\n"                       
+                "LDR     R2, [R12,#4]\n"                        
+                "MOV     R0, R3\n"                              
+                "MOV     R1, #0\n"                              
+                "CMP     R1, R2\n"                              
+                "BHI     loc_FF956DD4\n"                        
+                "BNE     loc_FF956DE4\n"                        
+                "LDR     R3, [R12]\n"                           
+                "CMP     R0, R3\n"                              
+                "BLS     loc_FF956DE4\n"                        
+"loc_FF956DD4:\n"                                               
+                                                            
+                "MOV     R3, #0\n"                              
+                "STR     R3, [R11]\n"                           
+                "MOV     R0, #0x80000005\n"                     
+                "B       loc_FF956E84\n"                        
+"loc_FF956DE4:\n"                                               
+                                                            
+                "LDR     R1, =0x5CD30\n"                        
+                "LDR     R0, =0x5CD80\n"                        
+                "LDR     R3, [R1]\n"                            
+                "LDR     R2, [R0]\n"                            
+                "ADD     R3, R3, R2,LSL#4\n"                    
+                "ADD     R3, R3, R3,LSL#2\n"                    
+                "LDR     R12, =0x5CD50\n"                       
+                "MOV     R3, R3,LSL#1\n"                        
+                "ADD     R3, R3, #0xA0\n"                       
+                "LDR     R2, [R12,#4]\n"                        
+                "MOV     R0, R3\n"                              
+                "MOV     R1, #0\n"                              
+                "CMP     R1, R2\n"                              
+                "BHI     loc_FF956E2C\n"                        
+                "BNE     loc_FF956E50\n"                        
+                "LDR     R3, [R12]\n"                           
+                "CMP     R0, R3\n"                              
+                "BLS     loc_FF956E50\n"                        
+"loc_FF956E2C:\n"                                               
+                "LDR     R4, =0x5CD68\n"                        
+                "LDR     R1, [R4]\n"                            
+                "CMP     R1, #0\n"                              
+                "BNE     loc_FF956E50\n"                        
+                "MOV     R0, #0x3140\n"                         
+                "ADD     R0, R0, #8\n"                          
+                "BL      sub_FF98020C\n"                        
+                "MOV     R3, #1\n"                              
+                "STR     R3, [R4]\n"                            
+"loc_FF956E50:\n"                                               
+                                                            
+                "LDR     R2, =0x5CD58\n"                        
+                "LDR     R3, [R2,#4]\n"                         
+                "CMP     R3, #0\n"                              
+                "BHI     loc_FF956E70\n"                        
+                "BNE     loc_FF956E80\n"                        
+                "LDR     R3, [R2]\n"                            
+                "CMP     R3, #0x40000000\n"                     
+          //    "BLS     loc_FF956E80\n"    // -
+
+                "B       loc_FF956E80\n"    // +
+                              
+"loc_FF956E70:\n"                                               
+                "MOV     R3, #0\n"                              
+                "STR     R3, [R11]\n"                           
+                "MOV     R0, #0x80000007\n"                     
+                "B       loc_FF956E84\n"                        
+"loc_FF956E80:\n"                                               
+                                                            
+                "MOV     R0, #0\n"                              
+"loc_FF956E84:\n"                                               
+                                                            
+                "ADD     SP, SP, #8\n"                          
+                "LDMFD   SP!, {R4-R11,PC}\n"                    
+
+ );
+}
+
+
+void __attribute__((naked,noinline)) sub_FF955964_my(){
+ asm volatile(
+                "CMP     R2, #1\n"                              
+                "STMFD   SP!, {R4-R7,LR}\n"                     
+                "MOV     R7, R0\n"                              
+                "MOV     R6, R1\n"                              
+                "LDREQ   R3, =CompressionRateTable\n"           
+                "LDREQ   R2, [R3]\n"                            
+                "STREQ   R2, [R6]\n"                            
+                "LDMEQFD SP!, {R4-R7,PC}\n"                     
+                "LDR     R12, =0x5CA60\n"                       
+                "LDR     R0, [R12]\n"                           
+                "LDR     R3, =0x5CA68\n"                        
+                "CMP     R0, #0\n"                              
+                "LDR     R1, [R3]\n"                            
+                "BEQ     loc_FF9559B0\n"                        
+                "LDR     R2, =0x5CA6C\n"                        
+                "LDR     R3, [R2]\n"                            
+                "CMP     R3, #1\n"                              
+                "BNE     loc_FF9559C4\n"                        
+                "B       loc_FF9559B4\n"                        
+"loc_FF9559B0:\n"                                               
+                "LDR     R2, =0x5CA6C\n"                        
+"loc_FF9559B4:\n"                                               
+                "MOV     R3, #0\n"                              
+                "STR     R3, [R2]\n"                            
+                "STR     R7, [R12]\n"                           
+                "B       loc_FF955A78\n"                        
+"loc_FF9559C4:\n"                                               
+                "LDR     R3, =0x5CA64\n"                        
+                "LDR     R2, [R3]\n"                            
+                "LDR     R5, =table1\n"   // + 0xFF955738                
+                "MOV     LR, R2,LSL#2\n"                        
+                "LDR     R3, [R5,LR]\n"                         
+                "LDR     R4, =table2\n"   // + 0xFF955818                
+                "RSB     R12, R3, R0\n"                         
+                "LDR     R2, [R4,LR]\n"                         
+                "CMP     R12, #0\n"                             
+                "RSB     R0, R2, R0\n"                          
+                "BLE     loc_FF955A24\n"                        
+                "ADD     R3, R5, #0x10\n"                       
+                "LDR     R2, [R3,LR]\n"                         
+                "CMP     R2, R12\n"                             
+                "ADDGE   R1, R1, #1\n"                          
+                "BGE     loc_FF955A18\n"                        
+                "ADD     R3, R5, #0x20\n"                       
+                "LDR     R2, [R3,LR]\n"                         
+                "CMP     R2, R12\n"                             
+                "ADDGE   R1, R1, #2\n"                          
+                "ADDLT   R1, R1, #3\n"                          
+"loc_FF955A18:\n"                                               
+           //   "CMP     R1, #0xE\n"    // -                     
+           //   "MOVGE   R1, #0xE\n"    // -                     
+                "CMP     R1, #0x1A\n"    // +                     
+                "MOVGE   R1, #0x1A\n"    // +                     
+
+                "B       loc_FF955A5C\n"                        
+"loc_FF955A24:\n"                                               
+                "CMP     R0, #0\n"                              
+                "BGE     loc_FF955A5C\n"                        
+                "ADD     R3, R4, #0x10\n"                       
+                "LDR     R2, [R3,LR]\n"                         
+                "CMP     R2, R0\n"                              
+                "SUBLE   R1, R1, #1\n"                          
+                "BLE     loc_FF955A54\n"                        
+                "ADD     R3, R4, #0x20\n"                       
+                "LDR     R2, [R3,LR]\n"                         
+                "CMP     R2, R0\n"                              
+                "SUBLE   R1, R1, #2\n"                          
+                "SUBGT   R1, R1, #3\n"                          
+"loc_FF955A54:\n"                                               
+                "CMP     R1, #0\n"                              
+                "MOVLT   R1, #0\n"                              
+"loc_FF955A5C:\n"                                               
+                                                            
+                "LDR     R0, =0x5CA68\n"                        
+                "LDR     R3, [R0]\n"                            
+                "CMP     R1, R3\n"                              
+                "LDRNE   R2, =0x5CA6C\n"                        
+                "MOVNE   R3, #1\n"                              
+                "STRNE   R1, [R0]\n"                            
+                "STRNE   R3, [R2]\n"                            
+"loc_FF955A78:\n"                                               
+                "LDR     R3, =0x5CA68\n"                        
+          //    "LDR     R1, =0x5658\n"     // -
+                "LDR     R1, =video_mode\n" //+                
+                "LDR     R0, [R3]\n"                            
+                "LDR     R2, =CompressionRateTable\n"           
+                "LDR     R12, [R1]\n"
+                "LDR     R12, [R12]\n" //+                         
+                "LDR     LR, [R2,R0,LSL#2]\n"                   
+                "LDR     R3, =0x5CA60\n"                        
+                "CMP     R12, #1\n"                             
+                "STR     R7, [R3]\n"                            
+                "STR     LR, [R6]\n"                            
+//              "MOVEQ   R3, #0xB\n"        // -                    
+
+                "LDREQ   R3, =video_quality\n"          // +
+                "LDREQ   R3, [R3]\n"                    // +
+                "LDREQ   R3, [R3]\n"                    // +
+
+                "STREQ   R3, [R6]\n"                            
+                "LDMFD   SP!, {R4-R7,PC}\n"                     
+ );
+}
+
+
+
Index: /trunk/platform/s2is/sub/100e/stubs_auto.S
===================================================================
--- /trunk/platform/s2is/sub/100e/stubs_auto.S	(revision 511)
+++ /trunk/platform/s2is/sub/100e/stubs_auto.S	(revision 511)
@@ -0,0 +1,96 @@
+/* THIS FILE IS GENERATED */
+/* DO NOT EDIT THIS FILE! */
+
+#include "stubs_asm.h"
+
+STUB(FF811298)
+STUB(FF811384)
+STUB(FF811444)
+STUB(FF8117DC)
+STUB(FF811800)
+STUB(FF8118C0)
+STUB(FF811A40)
+STUB(FF811A9C)
+STUB(FF811AA8)
+STUB(FF811ACC)
+STUB(FF811AEC)
+STUB(FF811B18)
+STUB(FF813D58)
+STUB(FF82072C)
+STUB(FF8208C8)
+STUB(FF820F34)
+STUB(FF82134C)
+STUB(FF821B6C)
+STUB(FF821D54)
+STUB(FF82275C)
+STUB(FF825F00)
+STUB(FF829978)
+STUB(FF8299D8)
+STUB(FF82A37C)
+STUB(FF8319D0)
+STUB(FF8A5390)
+STUB(FF8A543C)
+STUB(FF953B98)
+STUB(FF953BD4)
+STUB(FF95400C)
+STUB(FF954260)
+STUB(FF954714)
+STUB(FF9548F4)
+STUB(FF95497C)
+STUB(FF9549CC)
+STUB(FF954BAC)
+STUB(FF954D78)
+STUB(FF954E58)
+STUB(FF954EC4)
+STUB(FF955088)
+STUB(FF955218)
+STUB(FF955964)
+STUB(FF956A80)
+STUB(FF956ED4)
+STUB(FF9571BC)
+STUB(FF96A0BC)
+STUB(FF96A98C)
+STUB(FF96AE1C)
+STUB(FF96BD8C)
+STUB(FF96C05C)
+STUB(FF96C240)
+STUB(FF96D24C)
+STUB(FF96D9D0)
+STUB(FF96DA80)
+STUB(FF96DB78)
+STUB(FF96DCF0)
+STUB(FF96DFE0)
+STUB(FF96E07C)
+STUB(FF96E644)
+STUB(FF96E6D8)
+STUB(FF96E81C)
+STUB(FF96EB14)
+STUB(FF96EBF8)
+STUB(FF96ECB0)
+STUB(FF96EFBC)
+STUB(FF96F034)
+STUB(FF96F080)
+STUB(FF96F0E8)
+STUB(FF96F540)
+STUB(FF96F5D0)
+STUB(FF96F618)
+STUB(FF96F894)
+STUB(FF96FF14)
+STUB(FF97AE48)
+STUB(FF97AE54)
+STUB(FF97C2DC)
+STUB(FF98020C)
+STUB(FFADC0B8)
+STUB(FFAE9B84)
+STUB(FFAEA214)
+STUB(FFAEF9E0)
+STUB(FFAEFEE0)
+STUB(FFAF213C)
+STUB(FFAF605C)
+STUB(FFAF6AD4)
+STUB(FFAF8338)
+STUB(FFAF8A78)
+STUB(FFAFE01C)
+STUB(FFAFF92C)
+STUB(FFB026EC)
+STUB(FFB0726C)
Index: /trunk/platform/s2is/sub/100e/Makefile
===================================================================
--- /trunk/platform/s2is/sub/100e/Makefile	(revision 511)
+++ /trunk/platform/s2is/sub/100e/Makefile	(revision 511)
@@ -0,0 +1,6 @@
+topdir=../../../../
+
+OBJS=boot.o stubs_min.o stubs_auto.o stubs_entry.o lib.o stubs_entry_2.o capt_seq.o movie_rec.o
+STUBS_AUTO_DEPS=boot.c capt_seq.c movie_rec.c
+
+include $(topdir)/platform/makefile_sub.inc
Index: /trunk/platform/s2is/sub/100f/capt_seq.c
===================================================================
--- /trunk/platform/s2is/sub/100f/capt_seq.c	(revision 511)
+++ /trunk/platform/s2is/sub/100f/capt_seq.c	(revision 511)
@@ -0,0 +1,288 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+#define RAWDATA_AVAILABLE (1)
+#define RAWDATA_SAVED (2)
+
+#define NR_ON (1)
+#define NR_OFF (0)
+
+static long raw_save_stage;
+
+void capt_seq_hook_raw_here()
+{
+    raw_save_stage = RAWDATA_AVAILABLE;
+    core_rawdata_available();
+    while (raw_save_stage != RAWDATA_SAVED){
+	_SleepTask(10);
+    }
+}
+
+void hook_raw_save_complete()
+{
+    raw_save_stage = RAWDATA_SAVED;
+}
+
+
+void capt_seq_hook_set_nr()
+{
+    long *nrflag = (long*)0x5724;
+
+    switch (core_get_noise_reduction_value()){
+    case NOISE_REDUCTION_AUTO_CANON:
+	// leave it alone
+	break;
+    case NOISE_REDUCTION_OFF:
+	*nrflag = 0;
+	break;
+    case NOISE_REDUCTION_ON:
+	*nrflag = 1;
+	break;
+    };
+}
+
+
+
+void __attribute__((naked,noinline)) sub_FF96F5A8_my(long p)
+{
+    asm volatile (
+                "STMFD   SP!, {R4-R8,LR}\n"
+                "LDR     R3, =0x571C\n"
+                "SUB     SP, SP, #4\n"
+                "LDR     R2, [R3]\n"
+                "LDR     R4, =0x5720\n"
+                "CMP     R2, #0\n"
+                "STR     R0, [R4]\n"
+                "MOV     R8, #0\n"
+                "LDR     R6, =0xFF96F4E0\n"
+                "BNE     loc_FF96F5DC\n"
+                "LDR     R0, =0xFF96F59C\n"
+                "MOV     R1, #0xDB\n"
+                "BL      sub_FF813D58\n"
+"loc_FF96F5DC:\n"
+                "LDR     R3, =0x5D164\n"
+                "LDR     R1, =0xFFFFFFFF\n"
+                "LDR     R0, [R3]\n"
+                "BL      sub_FF8208C8\n"
+                "BL      sub_FF96F518\n"
+         //   "BL      wait_until_remote_button_is_released\n"
+	    	"BL      capt_seq_hook_set_nr\n"
+
+		"B       sub_FF96F5F0\n"
+    );
+}
+
+void __attribute__((naked,noinline)) sub_FF96C034_my(long p)
+{
+    asm volatile (
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "LDR     R5, [R0,#8]\n"
+                "BL      sub_FF97AE20\n"
+                "CMP     R0, #0\n"
+                "LDR     R0, =0xFF96C010\n"
+                "BNE     loc_FF96C054\n"
+                "BL      sub_FFAF21BC\n"
+                "BL      sub_FF97AE2C\n"
+"loc_FF96C054:\n"
+                "BL      sub_FF96A094\n"
+                "ADD     R3, R5, R5,LSL#1\n"
+                "RSB     R3, R5, R3,LSL#3\n"
+                "MOV     R6, R3,LSL#2\n"
+                "ADD     R0, R6, R0\n"
+                "LDR     R3, [R0,#8]\n"
+                "CMP     R3, #0\n"
+                "BEQ     loc_FF96C078\n"
+                "BL      sub_FF953B70\n"
+"loc_FF96C078:\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FF96E054\n"
+                "TST     R0, #1\n"
+                "MOV     R2, R5\n"
+                "MOV     R1, #1\n"
+                "BEQ     loc_FF96C098\n"
+                "LDMFD   SP!, {R4-R6,LR}\n"
+                "B       sub_FF96ADF4\n"
+"loc_FF96C098:\n"
+                "BL      sub_FF96A094\n"
+                "MOV     R4, R0\n"
+                "BL      sub_FF825F00\n"
+                "ADD     R4, R6, R4\n"
+                "STR     R0, [R4,#4]\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FF96FEEC\n"
+                "BL      sub_FF96E6B0\n"
+                "BL      sub_FF96E61C\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FF96F5A8_my\n"
+                "BL      capt_seq_hook_raw_here\n"
+                "MOV     R2, R5\n"
+                "MOV     R1, #1\n"
+                "BL      sub_FF96ADF4\n"
+                "BL      sub_FF96F86C\n"
+                "BL      sub_FF96A094\n"
+                "ADD     R0, R6, R0\n"
+                "LDR     R3, [R0,#8]\n"
+                "CMP     R3, #0\n"
+                "LDMEQFD SP!, {R4-R6,PC}\n"
+                "LDMFD   SP!, {R4-R6,LR}\n"
+                "B       sub_FF953BAC\n"
+
+    );
+}
+
+void __attribute__((naked,noinline)) capt_seq_task()
+{
+	asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                "SUB     SP, SP, #4\n"
+                "MOV     R4, SP\n"
+                "B       loc_FF96CBB0\n"
+"loc_FF96CA00:\n"
+                "LDR     R0, [SP,#0xC-0xC]\n"
+                "LDR     R3, [R0]\n"
+                "CMP     R3, #0x11\n"
+                "LDRLS   PC, [PC,R3,LSL#2]\n"
+                "B       loc_FF96CB98\n"
+                ".long loc_FF96CA5C\n"
+                ".long loc_FF96CA6C\n"
+                ".long loc_FF96CA80\n"
+                ".long loc_FF96CA90\n"
+                ".long loc_FF96CAA0\n"
+                ".long loc_FF96CAB0\n"
+                ".long loc_FF96CAC4\n"
+                ".long loc_FF96CAD4\n"
+                ".long loc_FF96CAE8\n"
+                ".long loc_FF96CAF8\n"
+                ".long loc_FF96CB08\n"
+                ".long loc_FF96CB18\n"
+                ".long loc_FF96CB28\n"
+                ".long loc_FF96CB3C\n"
+                ".long loc_FF96CB4C\n"
+                ".long loc_FF96CB5C\n"
+                ".long loc_FF96CB6C\n"
+                ".long loc_FF96CB80\n"
+"loc_FF96CA5C:\n"
+                "BL      sub_FF96D224\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #8\n"
+                "B       loc_FF96CB8C\n"
+"loc_FF96CA6C:\n"
+                "BL      sub_FF96D9A8\n"
+                "BL      shooting_expo_param_override\n"  // +
+                "BL      sub_FF96A964\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x10\n"
+                "B       loc_FF96CB8C\n"
+"loc_FF96CA80:\n"
+                "BL      sub_FF96C034_my\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #2\n"
+                "B       loc_FF96CB8C\n"
+"loc_FF96CA90:\n"
+                "BL      sub_FF96DFB8\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #1\n"
+                "B       loc_FF96CB8C\n"
+"loc_FF96CAA0:\n"
+                "BL      sub_FF96DA58\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x20\n"
+                "B       loc_FF96CB8C\n"
+"loc_FF96CAB0:\n"
+                "BL      sub_FF96DB50\n"
+                "BL      sub_FF96A964\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x40\n"
+                "B       loc_FF96CB8C\n"
+"loc_FF96CAC4:\n"
+                "BL      sub_FF96C218\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x80\n"
+                "B       loc_FF96CB8C\n"
+"loc_FF96CAD4:\n"
+                "BL      sub_FF96DCC8\n"
+                "BL      sub_FF96A964\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x400\n"
+                "B       loc_FF96CB8C\n"
+"loc_FF96CAE8:\n"
+                "BL      sub_FF96DA58\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x800\n"
+                "B       loc_FF96CB8C\n"
+"loc_FF96CAF8:\n"
+                "BL      sub_FF96E7F4\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x8000\n"
+                "B       loc_FF96CB8C\n"
+"loc_FF96CB08:\n"
+                "BL      sub_FF96EBD0\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x10000\n"
+                "B       loc_FF96CB8C\n"
+"loc_FF96CB18:\n"
+                "BL      sub_FF96EAEC\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x20000\n"
+                "B       loc_FF96CB8C\n"
+"loc_FF96CB28:\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF96EC88\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x40000\n"
+                "B       loc_FF96CB8C\n"
+"loc_FF96CB3C:\n"
+                "BL      sub_FF96EF94\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x80000\n"
+                "B       loc_FF96CB8C\n"
+"loc_FF96CB4C:\n"
+                "BL      sub_FF96F00C\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x100000\n"
+                "B       loc_FF96CB8C\n"
+"loc_FF96CB5C:\n"
+                "BL      sub_FF96F058\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x200000\n"
+                "B       loc_FF96CB8C\n"
+"loc_FF96CB6C:\n"
+                "MOV     R0, #1\n"
+                "BL      sub_FF96EC88\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x400000\n"
+                "B       loc_FF96CB8C\n"
+"loc_FF96CB80:\n"
+                "BL      sub_FF96F0C0\n"
+                "LDR     R3, =0x5D0FC\n"
+                "MOV     R1, #0x800000\n"
+"loc_FF96CB8C:\n"
+                "LDR     R0, [R3]\n"
+                "BL      sub_FF82072C\n"
+                "B       loc_FF96CBA8\n"
+"loc_FF96CB98:\n"
+                "MOV     R1, #0x374\n"
+                "LDR     R0, =0xFF96BCE4\n"
+                "ADD     R1, R1, #2\n"
+                "BL      sub_FF813D58\n"
+"loc_FF96CBA8:\n"
+                "LDR     R0, [SP,#0xC-0xC]\n"
+                "BL      sub_FF96BD64\n"
+"loc_FF96CBB0:\n"
+                "LDR     R3, =0x5D100\n"
+                "MOV     R1, R4\n"
+                "LDR     R0, [R3]\n"
+                "MOV     R2, #0\n"
+                "BL      sub_FF820F34\n"
+                "TST     R0, #1\n"
+                "BEQ     loc_FF96CA00\n"
+                "LDR     R0, =0xFF96BCE4\n"
+                "MOV     R1, #0x2EC\n"
+                "BL      sub_FF813D58\n"
+                "BL      sub_FF82275C\n"
+                "ADD     SP, SP, #4\n"
+                "LDMFD   SP!, {R4,PC}\n"
+	);
+}
+
Index: /trunk/platform/s2is/sub/100f/stubs_entry.S
===================================================================
--- /trunk/platform/s2is/sub/100f/stubs_entry.S	(revision 511)
+++ /trunk/platform/s2is/sub/100f/stubs_entry.S	(revision 511)
@@ -0,0 +1,180 @@
+// !!! THIS FILE IS GENERATED. DO NOT EDIT. !!!
+#include "stubs_asm.h"
+
+// Best match: 79%
+NSTUB(AllocateMemory, 0xff811ba0)
+NSTUB(AllocateUncacheableMemory, 0xff814810)
+// ERROR: Close is not found!
+NSTUB(CreatePhysicalVram, 0xff93e4cc)
+NSTUB(CreateTask, 0xff82239c)
+NSTUB(CreateTaskStrict, 0xff823964)
+NSTUB(DisableDispatch, 0xff82210c)
+// ERROR: DisplayImagePhysicalScreen is not found!
+NSTUB(EnableDispatch, 0xff822198)
+NSTUB(ExecuteEventProcedure, 0xff816ab4)
+NSTUB(ExitTask, 0xff82275c)
+NSTUB(Fclose_Fut, 0xff86fd34)
+NSTUB(Fopen_Fut, 0xff86fcf8)
+NSTUB(Fread_Fut, 0xff86fe18)
+// Best match: 66%
+NSTUB(FreeMemory, 0xff811bac)
+NSTUB(FreeUncacheableMemory, 0xff814844)
+NSTUB(Fseek_Fut, 0xff86ff00)
+NSTUB(Fwrite_Fut, 0xff86fe68)
+NSTUB(GetCurrentAvValue, 0xffaa6d44)
+// ALT: NSTUB(GetCurrentAvValue, 0xffaa8cf8) // 13/0
+NSTUB(GetCurrentTargetDistance, 0xffaa8ca0)
+// Best match: 87%
+NSTUB(GetFocusLensSubjectDistance, 0xffa8e9ec)
+// ALT: NSTUB(GetFocusLensSubjectDistance, 0xffa8e9ec) // 27/4
+// ERROR: GetFocusLensSubjectDistanceFromLens is not found!
+// Best match: 76%
+NSTUB(GetParameterData, 0xff987fb8)
+// ALT: NSTUB(GetParameterData, 0xff987fb8) // 23/7
+// Best match: 71%
+NSTUB(GetPropertyCase, 0xff825d04)
+// Best match: 96%
+NSTUB(GetSystemTime, 0xff814b98)
+// ALT: NSTUB(GetSystemTime, 0xff814b98) // 26/1
+// Best match: 68%
+NSTUB(GetZoomLensCurrentPoint, 0xffa881f4)
+// ALT: NSTUB(GetZoomLensCurrentPoint, 0xffa881f4) // 20/9
+// Best match: 51%
+NSTUB(GetZoomLensCurrentPosition, 0xffa88208)
+// ALT: NSTUB(GetZoomLensCurrentPosition, 0xffa88208) // 15/14
+NSTUB(IsStrobeChargeCompleted, 0xff912ee0)
+// Best match: 96%
+NSTUB(LockMainPower, 0xff9834c8)
+// Best match: 70%
+NSTUB(MakeDirectory, 0xff8775b0)
+// ERROR: Mount_FileSystem is not found!
+// Best match: 96%
+NSTUB(MoveFocusLensToDistance, 0xffaa8f30)
+// ERROR: MoveZoomLensWithPoint is not found!
+// ERROR: Open is not found!
+// ERROR: PhySw_testgpio is not found!
+NSTUB(ProtectFile, 0xff86f360)
+// Best match: 92%
+NSTUB(PutInNdFilter, 0xffaa6d58)
+// ALT: NSTUB(PutInNdFilter, 0xffaa6d58) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffaa6da0) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffaa6da0) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffaa7168) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffaa7168) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffaa88fc) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffaa88fc) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffaa8944) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffaa8944) // 25/2
+// Best match: 94%
+NSTUB(PutOutNdFilter, 0xffaa71b0)
+// ALT: NSTUB(PutOutNdFilter, 0xffaa71b0) // 16/1
+// ERROR: Read is not found!
+NSTUB(RefreshPhysicalScreen, 0xff9988b4)
+// ERROR: Remove is not found!
+// Best match: 96%
+NSTUB(SetAutoShutdownTime, 0xff9833c0)
+// Best match: 66%
+NSTUB(SetParameterData, 0xff987fb4)
+// ERROR: SetPropertyCase is not found!
+NSTUB(SleepTask, 0xff8221fc)
+// ALT: NSTUB(SleepTask, 0xff8222b0) // 31/0
+NSTUB(TakeSemaphore, 0xff821b6c)
+// Best match: 96%
+NSTUB(UnlockMainPower, 0xff98357c)
+NSTUB(Unmount_FileSystem, 0xff8762d4)
+// ERROR: UnsetZoomForMovie is not found!
+// Best match: 96%
+NSTUB(UpdateMBROnFlash, 0xff876480)
+// ERROR: VbattGet is not found!
+// ERROR: Write is not found!
+NSTUB(_log, 0xffae0ac0)
+// ALT: NSTUB(_log, 0xffae0ac0) // 27/0
+NSTUB(_log10, 0xffae1168)
+// ALT: NSTUB(_log10, 0xffae1168) // 27/0
+NSTUB(_pow, 0xffae1658)
+// ALT: NSTUB(_pow, 0xffae1658) // 25/0
+NSTUB(_sqrt, 0xffae59a4)
+// ALT: NSTUB(_sqrt, 0xffae59a4) // 24/0
+NSTUB(chdir, 0xffaf4c00)
+// ALT: NSTUB(chdir, 0xffaf4c00) // 27/0
+NSTUB(close, 0xffaf4540)
+NSTUB(closedir, 0xffaf04e0)
+// ERROR: free is not found!
+NSTUB(ints_disable, 0xff81e254)
+NSTUB(ints_enable, 0xff81e260)
+NSTUB(ioctl, 0xffaf4680)
+NSTUB(iosDevAdd, 0xffaf5760)
+NSTUB(iosDrvInstall, 0xffaf5a24)
+NSTUB(isalpha, 0xffaea454)
+// ALT: NSTUB(isalpha, 0xffaea454) // 4/0
+NSTUB(isdigit, 0xffaea484)
+// ALT: NSTUB(isdigit, 0xffaea484) // 4/0
+NSTUB(islower, 0xffaea4b4)
+// ALT: NSTUB(islower, 0xffaea4b4) // 4/0
+NSTUB(isspace, 0xffaea4fc)
+// ALT: NSTUB(isspace, 0xffaea4fc) // 4/0
+NSTUB(isupper, 0xffaea514)
+// ALT: NSTUB(isupper, 0xffaea514) // 4/0
+// ERROR: kbd_p1_f is not found!
+// ERROR: kbd_p1_f_cont is not found!
+// ERROR: kbd_p2_f is not found!
+// Best match: 83%
+NSTUB(kbd_pwr_off, 0xff82b0d4)
+// ALT: NSTUB(kbd_pwr_off, 0xff82b0f0) // 5/1
+// Best match: 55%
+NSTUB(kbd_pwr_on, 0xff9402b0)
+// ALT: NSTUB(kbd_pwr_on, 0xff9402dc) // 5/4
+// ERROR: kbd_read_keys_r2 is not found!
+// Best match: 93%
+NSTUB(localtime, 0xffaeecd4)
+NSTUB(lseek, 0xffaf4684)
+// Best match: 53%
+NSTUB(malloc, 0xffaf7580)
+// ALT: NSTUB(malloc, 0xffaf7580) // 15/13
+NSTUB(memcmp, 0xffaee0b4)
+// ALT: NSTUB(memcmp, 0xffafc49c) // 9/0
+NSTUB(memcpy, 0xffaee0f0)
+NSTUB(memset, 0xffaee168)
+// Best match: 61%
+NSTUB(mkdir, 0xff8774fc)
+// ALT: NSTUB(mkdir, 0xff8775bc) // 19/12
+NSTUB(open, 0xffaf4b84)
+NSTUB(opendir, 0xffaf0514)
+NSTUB(qsort, 0xffaed914)
+NSTUB(rand, 0xffaed938)
+// ALT: NSTUB(rand, 0xffaed938) // 8/0
+NSTUB(read, 0xffaf45a0)
+NSTUB(readdir, 0xffaf04ac)
+NSTUB(rename, 0xffaf4b8c)
+// ALT: NSTUB(rename, 0xffaf4b8c) // 26/0
+NSTUB(rewinddir, 0xffaf04d4)
+NSTUB(srand, 0xffaed95c)
+// ALT: NSTUB(srand, 0xffaed95c) // 4/0
+NSTUB(stat, 0xffaf05a8)
+NSTUB(strcat, 0xffaee188)
+NSTUB(strchr, 0xffaee1b4)
+NSTUB(strcmp, 0xffaee1d8)
+NSTUB(strcpy, 0xffaee36c)
+NSTUB(strlen, 0xffaee4d0)
+NSTUB(strncmp, 0xffaee534)
+NSTUB(strncpy, 0xffaee578)
+// ALT: NSTUB(strncpy, 0xffaee578) // 24/0
+NSTUB(strpbrk, 0xffaee5c0)
+NSTUB(strrchr, 0xffaee5fc)
+// ALT: NSTUB(strrchr, 0xffaee5fc) // 8/0
+NSTUB(strtol, 0xffaedd50)
+NSTUB(taskCreateHookAdd, 0xffafac00)
+NSTUB(taskDeleteHookAdd, 0xffafab3c)
+// Best match: 82%
+NSTUB(taskIdListGet, 0xffb026e4)
+NSTUB(taskLock, 0xffb02da0)
+NSTUB(taskName, 0xffb025dc)
+NSTUB(taskResume, 0xffb029c0)
+NSTUB(taskSuspend, 0xffb027ec)
+NSTUB(taskUnlock, 0xffb02e48)
+NSTUB(time, 0xffaefa20)
+// ALT: NSTUB(time, 0xffaefa20) // 25/0
+NSTUB(utime, 0xffaf063c)
+// ALT: NSTUB(utime, 0xffaf063c) // 26/0
+NSTUB(vsprintf, 0xffaf1e00)
+NSTUB(write, 0xffaf4610)
Index: /trunk/platform/s2is/sub/100f/stubs_entry_2.S
===================================================================
--- /trunk/platform/s2is/sub/100f/stubs_entry_2.S	(revision 511)
+++ /trunk/platform/s2is/sub/100f/stubs_entry_2.S	(revision 511)
@@ -0,0 +1,42 @@
+#include "stubs_asm.h"
+
+NHSTUB(Close, 0xFF877374)
+NHSTUB(Remove, 0xFF877380)
+NHSTUB(DisplayImagePhysicalScreen, 0xff93dc88)
+NHSTUB(free, 0xFFAF758C)
+NHSTUB(Open, 0xFF877368)
+NHSTUB(Read, 0xFF8773D4)
+NHSTUB(Write, 0xFF8773E0)
+NHSTUB(VbattGet, 0xFF82D570)
+NHSTUB(Mount_FileSystem, 0xFF876264)
+NHSTUB(SetParameterData, 0xFF987EE4)
+NHSTUB(GetPropertyCase, 0xFF825D08)
+NHSTUB(SetPropertyCase, 0xFF825C00)
+NHSTUB(GetZoomLensCurrentPosition, 0xFFAA8838)
+NHSTUB(GetZoomLensCurrentPoint, 0xFFAA8824)
+NHSTUB(MoveZoomLensWithPoint, 0xFFA88000)
+NHSTUB(SetZoomActuatorSpeedPercent, 0xFFA88178)
+
+NHSTUB(kbd_p1_f, 0xFF829470)
+NHSTUB(kbd_p1_f_cont, 0xFF829484)
+NHSTUB(kbd_read_keys_r2, 0xFF829E58)
+NHSTUB(platformsub_kbd_fetch_data, 0xFF829F8C)
+NHSTUB(kbd_p2_f, 0xFF829364)
+
+// null stubs
+NHSTUB(PhySw_testgpio, 0xFF8118C0)
+NHSTUB(UnsetZoomForMovie, 0xFF8118C0)
+
+NHSTUB(UniqueLedOn, 0xFF82EBDC)
+NHSTUB(UniqueLedOff, 0xFF82EC54)
+
+NHSTUB(GetDrive_ClusterSize, 0xFF8767A0)
+NHSTUB(GetDrive_TotalClusters, 0xFF8767FC)
+NHSTUB(GetDrive_FreeClusters, 0xFF876838)
+NHSTUB(GetFocusLensSubjectDistanceFromLens, 0xffa8ef74)
+NHSTUB(GetBatteryTemperature, 0xFF82E368)
+NHSTUB(GetCCDTemperature, 0xFF82E354)
+NHSTUB(GetOpticalTemperature, 0xFF82E340)
+NHSTUB(PT_PlaySound, 0xFF97BD18)
+NHSTUB(EnterToCompensationEVF, 0xff968128) 
+NHSTUB(ExitFromCompensationEVF, 0xff96817c) 
Index: /trunk/platform/s2is/sub/100f/boot.c
===================================================================
--- /trunk/platform/s2is/sub/100f/boot.c	(revision 511)
+++ /trunk/platform/s2is/sub/100f/boot.c	(revision 511)
@@ -0,0 +1,239 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+const long new_sa = MEMISOSTART + MEMISOSIZE;
+
+/* Ours stuff */
+extern long wrs_kernel_bss_start;
+extern long wrs_kernel_bss_end;
+extern void createHook (void *pNewTcb);
+extern void deleteHook (void *pTcb);
+
+void boot();
+
+/* "relocated" functions */
+void __attribute__((naked,noinline)) h_usrInit();
+void __attribute__((naked,noinline)) h_usrKernelInit();
+void __attribute__((naked,noinline)) h_usrRoot();
+
+extern void mykbd_task_proceed_2();
+
+
+void __attribute__((naked,noinline)) h_kbd_p2_f()
+{
+    asm volatile (
+                 "LDR     R4, =0x10390\n"
+                 "LDR     R1, [R4,#0x30]\n"
+                 "TST     R1, #0x8000\n"
+                 "BEQ     loc_FF829394\n"
+                 "MOV     R1, #0\n"
+                 "MOV     R0, #0xF\n"
+                 "MOV     R2, #0x8000\n"
+                 "BL      sub_FF829978\n"
+                 "LDR     R3, [R4,#0x30]\n"
+                 "BIC     R3, R3, #0x8000\n"
+                 "STR     R3, [R4,#0x30]\n"
+                 "MOV     R1, R3\n"
+  "loc_FF829394:\n"
+                 "TST     R1, #1\n"
+                 "BEQ     loc_FF8293BC\n"
+                 "MOV     R0, #0\n"
+                 "MOV     R1, R0\n"
+                 "MOV     R2, R5\n"
+                 "BL      sub_FF829978\n"
+                 "LDR     R3, [R4,#0x30]\n"
+                 "BIC     R3, R3, #1\n"
+                 "STR     R3, [R4,#0x30]\n"
+                 "MOV     R1, R3\n"
+  "loc_FF8293BC:\n"
+                 "TST     R1, #2\n"
+                 "BEQ     loc_FF8293E4\n"
+                 "MOV     R1, #0\n"
+                 "MOV     R0, R5\n"
+                 "MOV     R2, #2\n"
+                 "BL      sub_FF829978\n"
+                 "LDR     R3, [R4,#0x30]\n"
+                 "BIC     R3, R3, #2\n"
+                 "STR     R3, [R4,#0x30]\n"
+                 "MOV     R1, R3\n"
+  "loc_FF8293E4:\n"
+                 "LDR     R3, [R4,#0x34]\n"
+                 "LDR     R2, [R4,#0x38]\n"
+                 "ADD     R3, R1, R3\n"
+                 "CMN     R3, R2\n"
+                 "BEQ     loc_FF8293FC\n"
+                 "BL      sub_FF8299D8\n"
+  "loc_FF8293FC:\n"
+                 "LDR     R3, =0x1FC0\n"
+                 "LDR     R1, [R3]\n"
+                 "CMP     R1, #1\n"
+                 "BNE     loc_FF829418\n"
+                 "MOV     R0, #0x28\n"
+                 "MOV     R2, #0x100\n"
+                 "BL      sub_FF829978\n"
+  "loc_FF829418:\n"
+                 "LDR     R3, =0x1038C\n"
+                 "LDR     R0, [R3]\n"
+                 "CMP     R0, #1\n"
+                 "BNE     loc_FF829440\n"
+                 "MOV     R3, #0x30\n"
+                 "STRH    R3, [SP,#2]\n"
+                 "MOV     R1, R6\n"
+                 "LDR     R3, =0x103F0\n"
+                 "MOV     LR, PC\n"
+                 "LDR     PC, [R3]\n"
+  "loc_FF829440:\n"
+                 "BL      sub_FF82A37C\n"
+                 "B       mykbd_task_proceed_2\n"
+    );
+}
+
+
+void boot()
+{
+    long *canon_data_src = (void*)0xFFB09320;
+    long *canon_data_dst = (void*)0x1900;
+    long canon_data_len = 0xDBB0;
+    long *canon_bss_start = (void*)0xF4B0; // just after data
+    long canon_bss_len = 0x6EF50 - 0xF4B0;
+    long i;
+
+    asm volatile (
+	"MRC     p15, 0, R0,c1,c0\n"
+	"ORR     R0, R0, #0x1000\n"
+	"ORR     R0, R0, #4\n"
+	"ORR     R0, R0, #1\n"
+	"MCR     p15, 0, R0,c1,c0\n"
+    :::"r0");
+
+
+    for(i=0;i<canon_data_len/4;i++)
+	canon_data_dst[i]=canon_data_src[i];
+
+    for(i=0;i<canon_bss_len/4;i++)
+	canon_bss_start[i]=0;
+
+    asm volatile (
+	"MRC     p15, 0, R0,c1,c0\n"
+	"ORR     R0, R0, #0x1000\n"
+	"BIC     R0, R0, #4\n"
+	"ORR     R0, R0, #1\n"
+	"MCR     p15, 0, R0,c1,c0\n"
+    :::"r0");
+
+    h_usrInit();
+}
+
+
+void h_usrInit()
+{
+    asm volatile (
+	"STR	LR, [SP,#-4]!\n"
+	"BL	sub_FF811A40\n"
+	"MOV	R0, #2\n"
+	"MOV	R1, R0\n"
+	"BL	sub_FFAEFA60\n"
+	"BL	sub_FFADC138\n"
+	"BL	sub_FF811298\n"
+	"BL	sub_FF811800\n"
+	"LDR	LR, [SP],#4\n"
+	"B	h_usrKernelInit\n"
+    );
+}
+
+void  h_usrKernelInit()
+{
+    asm volatile (
+	"STMFD	SP!, {R4,LR}\n"
+	"SUB	SP, SP, #8\n"
+	"BL	sub_FFAEFF60\n"
+	"BL	sub_FFB0276C\n"
+	"LDR	R3, =0xE8EC\n"
+	"LDR	R2, =0x6A2C0\n"
+	"LDR	R1, [R3]\n"
+	"LDR	R0, =0x6E910\n"
+	"MOV	R3, #0x100\n"
+	"BL	sub_FFAFE09C\n"
+	"LDR	R3, =0xE8AC\n"
+	"LDR	R0, =0xECCC\n"
+	"LDR	R1, [R3]\n"
+	"BL	sub_FFAFE09C\n"
+	"LDR	R3, =0xE968\n"
+	"LDR	R0, =0x6E8E4\n"
+	"LDR	R1, [R3]\n"
+	"BL	sub_FFAFE09C\n"
+	"BL	sub_FFB072EC\n"
+	"BL	sub_FF811384\n"
+	"MOV	R4, #0\n"
+	"MOV	R3, R0\n"
+	"MOV	R12, #0x800\n"
+	"LDR	R0, =h_usrRoot\n"
+	"MOV	R1, #0x4000\n"
+    );    
+//	"LDR	R2, =0x9EF50\n"	// 0x6EF50 + 0x30000
+    asm volatile (
+        "LDR     R2, =new_sa\n"
+        "LDR     R2, [R2]\n"
+    );
+    asm volatile (
+	"STR	R12, [SP]\n"
+	"STR	R4, [SP,#4]\n"
+	"BL	sub_FFAFF9AC\n"
+	"ADD	SP, SP, #8\n"
+	"LDMFD	SP!, {R4,PC}\n"
+    );
+}
+
+static long drv_struct[16];
+ 
+static long dh_err()
+{
+    return -1;
+}
+
+static void drv_self_hide()
+{
+    long drvnum;
+    
+    drvnum = _iosDrvInstall(dh_err,dh_err,dh_err,dh_err,dh_err,dh_err,dh_err);
+    if (drvnum >= 0)
+	_iosDevAdd(drv_struct, "A/DISKBOOT.BIN", drvnum);
+}
+
+
+void  h_usrRoot()
+{
+    asm volatile (
+	"STMFD	SP!, {R4,R5,LR}\n"
+	"MOV	R5, R0\n"
+	"MOV	R4, R1\n"
+	"BL	sub_FF811AA8\n"
+	"MOV	R1, R4\n"
+	"MOV	R0, R5\n"
+	"BL	sub_FFAF60DC\n"
+	"MOV	R1, R4\n"
+	"MOV	R0, R5\n"
+	"BL	sub_FFAF6B54\n"
+	"BL	sub_FF8118C0\n"
+	"BL	sub_FF8117DC\n"
+	"MOV	R0, #0x32\n"
+	"BL	sub_FFAF8AF8\n"
+	"BL	sub_FF811AEC\n"
+	"BL	sub_FF811ACC\n"
+	"BL	sub_FF811B18\n"
+	"BL	sub_FFAF83B8\n"
+	"BL	sub_FF811A9C\n"
+    );
+
+    _taskCreateHookAdd(createHook);
+    _taskDeleteHookAdd(deleteHook);
+
+    drv_self_hide();
+
+    asm volatile (
+	"LDMFD	SP!, {R4,R5,LR}\n"
+	"B	sub_FF811444\n"
+    );
+}
+
Index: /trunk/platform/s2is/sub/100f/stubs_min.S
===================================================================
--- /trunk/platform/s2is/sub/100f/stubs_min.S	(revision 511)
+++ /trunk/platform/s2is/sub/100f/stubs_min.S	(revision 511)
@@ -0,0 +1,14 @@
+#include "stubs_asm.h"
+
+DEF(physw_status, 0x103C0)
+DEF(physw_run, 0x1FC0)
+DEF(playrec_mode, 0x569C)
+DEF(kbd_const_1, 0x10464)
+DEF(led_table, 0x105F0)
+DEF(zoom_busy, 0x64460)
+DEF(focus_busy, 0x645D4)
+DEF(FlashParamsTable,0xFF985878)
+DEF(canon_menu_active,0x7BA0)
+DEF(canon_shoot_menu_active,0x6C91)
+DEF(recreview_hold, 0x60FB0)
+DEF(movie_status,0x5C95C)
Index: /trunk/platform/s2is/sub/100f/makefile.inc
===================================================================
--- /trunk/platform/s2is/sub/100f/makefile.inc	(revision 511)
+++ /trunk/platform/s2is/sub/100f/makefile.inc	(revision 511)
@@ -0,0 +1,15 @@
+#0x30F0
+PLATFORMID=12528
+
+PLATFORMOS=vxworks
+
+MEMBASEADDR=0x1900
+RESTARTSTART=0x50000
+MEMISOSTART=0x6EF50
+MEMISOSIZE=0x55000
+ROMBASEADDR=0xff810000
+
+TARGET_PRIMARY=$(topdir)platform/$(PLATFORM)/sub/$(PLATFORMSUB)/PRIMARY.BIN
+
+PLFLAGS=-DMEMBASEADDR=$(MEMBASEADDR) -DMEMISOSTART=$(MEMISOSTART) -DMEMISOSIZE=$(MEMISOSIZE)
+PLFLAGS+=-DRESTARTSTART=$(RESTARTSTART)
Index: /trunk/platform/s2is/sub/100f/stubs_asm.h
===================================================================
--- /trunk/platform/s2is/sub/100f/stubs_asm.h	(revision 511)
+++ /trunk/platform/s2is/sub/100f/stubs_asm.h	(revision 511)
@@ -0,0 +1,20 @@
+    .text
+
+#define DEF(n,a) \
+    .globl n; n = a
+
+#define NSTUB(name, addr)\
+    .globl _##name ;\
+    .weak _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define NHSTUB(name, addr)\
+    .globl _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define STUB(addr)\
+    .globl sub_ ## addr ;\
+    sub_ ## addr: ;\
+	ldr  pc, =0x ## addr
Index: /trunk/platform/s2is/sub/100f/lib.c
===================================================================
--- /trunk/platform/s2is/sub/100f/lib.c	(revision 511)
+++ /trunk/platform/s2is/sub/100f/lib.c	(revision 511)
@@ -0,0 +1,65 @@
+#include "platform.h"
+
+void *hook_raw_fptr()
+{
+    return (void*)0x2F490;
+}
+
+void *hook_raw_ret_addr()
+{
+    return (void*)0xFF8D8BB4;
+}
+
+char *hook_raw_image_addr()
+{
+    return (char*)(0x10595D54);
+}
+
+long hook_raw_size()
+{
+    return 0x644C40;
+}
+
+void *vid_get_viewport_live_fb()
+{
+    return (void*)0x0;
+}
+
+void *vid_get_bitmap_fb()
+{
+    return (void*)0x103CEB20;
+}
+
+void *vid_get_viewport_fb()
+{
+    return (void*)0x105F84F0; // 0x104B6C20;
+}
+
+void *vid_get_viewport_fb_d()
+{
+    return (void*)(*(int*)0x5BAEC);   //0x5BAD8, 0x5BAEC, 0x5BB00
+}
+
+long vid_get_bitmap_screen_width()
+{
+    return 360;
+}
+
+long vid_get_bitmap_screen_height()
+{
+    return 240;
+}
+
+long vid_get_viewport_height()
+{
+    return 240;
+}
+char *camera_jpeg_count_str()
+{
+    return (char*)0x63518;
+}
+
+long vid_get_bitmap_buffer_width() { return 360; }
+
+long vid_get_bitmap_buffer_height() { return 240; }
+
Index: /trunk/platform/s2is/sub/100f/movie_rec.c
===================================================================
--- /trunk/platform/s2is/sub/100f/movie_rec.c	(revision 511)
+++ /trunk/platform/s2is/sub/100f/movie_rec.c	(revision 511)
@@ -0,0 +1,658 @@
+#include "conf.h"
+
+int *video_quality = &conf.video_quality;
+int *video_mode    = &conf.video_mode;
+
+long def_table1[56]={
+0x10000,0xC000,0x5800, 0x2000, 0x1C6A, 0x1550,0x9C5,  0x38D,  0x3C45, 0x2D34, 0x14B8, 0x788,  0x5F60, 0x4788,
+0x20C9, 0xBE1, 0x8661, 0x64C9, 0x2E31, 0x10CB,0xB21A, 0x8594, 0x3D39, 0x1642, 0xE249, 0xA9B8, 0x4DC9, 0x1C48,
+0x117D2,0xD1DF,0x6030, 0x22F9, 0x153D5,0xFEE1,0x74D1, 0x2A79, 0x195F8,0x1307C,0x8B8D, 0x32AA, 0x1E01C,0x16817,
+0xA509, 0x3C01,0x2328E,0x1A5ED,0xC160, 0x4637,0x28C99,0x1E975,0xE054, 0x5190, 0x2F08B,0x2346B,0x102AF,0x5E0E
+};
+
+long def_table2[12]={0xE666,0xACCD,0x4F33,0x1CCD,-0x170A,-0x1148,-0x7EB,-0x2E1,-0x2BC6,-0x20D5,-0xF0C,-0x579};
+
+long table1[56], table2[12];
+
+void change_video_tables(int a, int b){
+ int i;
+ for (i=0;i<56;i++) table1[i]=(def_table1[i]*a)/b;
+ for (i=0;i<12;i++) table2[i]=(def_table2[i]*a)/b;
+}
+
+long CompressionRateTable[]={0x60, 0x5D, 0x5A, 0x57, 0x54, 0x51, 0x4D, 0x48, 0x42, 0x3B, 0x32, 0x29, 0x22, 0x1D, 0x17, 0x14, 0x10, 0xE, 0xB, 9, 7, 6, 5, 4, 3, 2, 1};
+
+
+void __attribute__((naked,noinline)) movie_record_task(){
+ asm volatile(
+                "STMFD   SP!, {R4,LR}\n"              
+                "SUB     SP, SP, #4\n"                
+                "MOV     R4, SP\n"                    
+                "B       loc_FF953F50\n"              
+"loc_FF953E7C:\n"                                     
+                "LDR     R3, =0x5C940\n"              
+                "LDR     R2, [R3]\n"                  
+                "CMP     R2, #0\n"                    
+                "BNE     loc_FF953F18\n"              
+                "SUB     R3, R12, #1\n"               
+                "CMP     R3, #0xA\n"                  
+                "LDRLS   PC, [PC,R3,LSL#2]\n"         
+                "B       loc_FF953F18\n"              
+                ".long loc_FF953EC8\n"
+                ".long loc_FF953ED0\n"
+                ".long loc_FF953EE8\n"
+                ".long loc_FF953EF0\n"
+                ".long loc_FF953EF8\n"
+                ".long loc_FF953ED8\n"
+                ".long loc_FF953F00\n"
+                ".long loc_FF953EE0\n"
+                ".long loc_FF953F18\n"
+                ".long loc_FF953F10\n"
+                ".long loc_FF953F08\n"
+"loc_FF953EC8:\n"                                     
+                                                  
+                "BL      sub_FF953FE4\n"              
+                "B       loc_FF953F14\n"              
+"loc_FF953ED0:\n"                                     
+                                                  
+                "BL      sub_FF954238\n" 
+                "B       loc_FF953F14\n"              
+"loc_FF953ED8:\n"                                     
+                                                  
+                "BL      sub_FF9546EC_my\n"   //----------------->           
+                "B       loc_FF953F14\n"              
+"loc_FF953EE0:\n"                                     
+                                                  
+                "BL      sub_FF954B84\n"              
+                "B       loc_FF953F14\n"              
+"loc_FF953EE8:\n"                                     
+                                                  
+                "BL      sub_FF954954\n"              
+                "B       loc_FF953F14\n"              
+"loc_FF953EF0:\n"                                     
+                                                  
+                "BL      sub_FF954E9C\n"              
+                "B       loc_FF953F14\n"              
+"loc_FF953EF8:\n"                                     
+                                                  
+                "BL      sub_FF955060\n"              
+                "B       loc_FF953F14\n"              
+"loc_FF953F00:\n"                                     
+                                                  
+                "BL      sub_FF954D50\n"              
+                "B       loc_FF953F14\n"              
+"loc_FF953F08:\n"                                     
+                                                  
+                "BL      sub_FF954E30\n"              
+                "B       loc_FF953F14\n"              
+"loc_FF953F10:\n"                                     
+                                                  
+                "BL      sub_FF9549A4\n"              
+"loc_FF953F14:\n"                                     
+                                                  
+                "LDR     R1, [SP]\n"                  
+"loc_FF953F18:\n"                                     
+                                                  
+                "LDR     R3, [R1]\n"                  
+                "CMP     R3, #9\n"                    
+                "BNE     loc_FF953F30\n"              
+                "MOV     R0, R1\n"                    
+                "BL      sub_FF9551F0\n"  //  maybe            
+                "LDR     R1, [SP]\n"                  
+"loc_FF953F30:\n"                                     
+                "LDR     R3, =0x5C870\n"              
+                "MOV     R2, #0\n"                    
+                "LDR     R0, [R3]\n"                  
+                "STR     R2, [R1]\n"                  
+                "BL      sub_FF82134C\n"          
+                "LDR     R3, =0x5CA10\n"              
+                "LDR     R0, [R3]\n"                  
+                "BL      sub_FF821D54\n"             
+"loc_FF953F50:\n"                                     
+                "LDR     R3, =0x5C86C\n"              
+                "MOV     R1, R4\n"                    
+                "LDR     R0, [R3]\n"                  
+                "MOV     R2, #0\n"                    
+                "BL      sub_FF820F34\n"       
+                "LDR     R3, =0x5CA10\n"              
+                "MOV     R1, #0\n"                    
+                "LDR     R0, [R3]\n"                  
+                "BL      sub_FF821B6C\n"             
+                "LDR     R0, [SP]\n"                  
+                "LDR     R12, [R0]\n"                 
+                "CMP     R12, #0xC\n"                 
+                "MOV     R1, R0\n"                    
+                "BNE     loc_FF953E7C\n"              
+                "LDR     R3, =0x5C864\n"              
+                "LDR     R0, [R3]\n"                  
+                "BL      sub_FF821D54\n"             
+                "BL      sub_FF82275C\n"                  
+                "ADD     SP, SP, #4\n"                
+                "LDMFD   SP!, {R4,PC}\n"              
+
+ );
+}
+
+
+void __attribute__((naked,noinline)) sub_FF9546EC_my(){
+ asm volatile(
+                "STMFD   SP!, {R4-R8,LR}\n"           
+                "LDR     R5, =0x5C95C\n"              
+                "SUB     SP, SP, #0x1C\n"             
+                "LDR     R3, [R5]\n"                  
+                "CMP     R3, #3\n"                    
+                "MOV     R4, R0\n"                    
+                "MOVEQ   R3, #4\n"                    
+                "STREQ   R3, [R5]\n"                  
+                "LDR     R3, =0x5CA04\n"              
+                "MOV     LR, PC\n"                    
+                "LDR     PC, [R3]\n"                  
+                "LDR     R2, [R5]\n"                  
+                "CMP     R2, #4\n"                    
+                "BNE     loc_FF954884\n"              
+                "ADD     R0, SP, #0x18\n"             
+                "BL      sub_FF956A58_my\n"   //---------------->          
+                "CMP     R0, #0\n"                    
+                "BNE     loc_FF95475C\n"              
+                "LDR     R3, =0x5C948\n"              
+                "LDR     R2, [R3]\n"                  
+                "CMP     R2, #1\n"                    
+                "BNE     loc_FF954778\n"              
+                "LDR     R2, =0x5C998\n"              
+                "LDR     R1, =0x5C970\n"              
+                "LDR     R12, [R2]\n"                 
+                "LDR     R3, [R1]\n"                  
+                "CMP     R12, R3\n"                   
+                "BCC     loc_FF954778\n"              
+"loc_FF95475C:\n"                                     
+                "BL      sub_FF9548CC\n"              
+                "LDR     R3, =0x5654\n"               
+                "LDR     R0, [R3]\n"                  
+                "BL      sub_FF8319D0\n"              
+                "MOV     R3, #5\n"                    
+                "STR     R3, [R5]\n"                  
+                "B       loc_FF954884\n"              
+"loc_FF954778:\n"                                     
+                                                  
+                "LDR     R0, [R4,#4]\n"               
+                "LDR     R5, [R4,#0xC]\n"             
+                "LDR     R3, =0x5C9A0\n"              
+                "LDR     R4, [R4,#8]\n"               
+                "LDR     R8, =0x5C9AC\n"              
+                "LDR     R6, =0x5C94C\n"              
+                "ADD     R12, SP, #0x14\n"            
+                "ADD     LR, SP, #0x10\n"             
+                "MOV     R7, #1\n"                    
+                "LDR     R2, [R3]\n"                  
+                "LDR     R1, [SP,#0x18]\n"            
+                "STMEA   SP, {R4,R5,R12,LR}\n"        
+                "LDR     R3, [R8]\n"                  
+                "STR     R7, [R6]\n"                  
+                "BL      sub_FF8A5368\n"              
+                "LDR     R3, =0x5C864\n"              
+                "MOV     R1, #0x3E8\n"                
+                "LDR     R0, [R3]\n"                  
+                "BL      sub_FF821B6C\n"             
+                "CMP     R0, #9\n"                    
+                "BNE     loc_FF9547DC\n"              
+                "BL      sub_FF957194\n"              
+                "LDR     R3, =0x5C95C\n"              
+                "LDR     R0, =0xFF9546D4\n"       
+                "B       loc_FF9547F4\n"              
+"loc_FF9547DC:\n"                                     
+                "LDR     R5, [SP,#0x10]\n"            
+                "CMP     R5, #0\n"                    
+                "BEQ     loc_FF954800\n"              
+                "BL      sub_FF957194\n"              
+                "LDR     R3, =0x5C95C\n"              
+                "LDR     R0, =0xFF9546E0\n"       
+"loc_FF9547F4:\n"                                     
+                "STR     R7, [R3]\n"                  
+                "BL      sub_FF97C2B4\n"              
+                "B       loc_FF954884\n"              
+"loc_FF954800:\n"                                     
+                "BL      sub_FF8A5414\n"              
+                "LDR     R0, [SP,#0x18]\n"            
+                "LDR     R1, [SP,#0x14]\n"            
+                "BL      sub_FF956EAC\n"              
+                "LDR     R4, =0x5C998\n"              
+                "LDR     R3, [R4]\n"                  
+                "ADD     R3, R3, #1\n"                
+                "LDR     R0, [SP,#0x14]\n"            
+                "MOV     R1, R8\n"                    
+                "STR     R3, [R4]\n"                  
+                "MOV     R2, R5\n"                    
+                "BL      sub_FF95593C_my\n"   //-------------------->           
+                "LDR     R3, =0x5C984\n"              
+                "LDR     R4, [R4]\n"                  
+                "LDR     R1, [R3]\n"                  
+                "MOV     R0, R4\n"                    
+                "BL      sub_FFAEA294\n"                 
+                "CMP     R0, #0\n"                    
+                "BEQ     loc_FF954860\n"              
+                "LDR     R6, =0x5C950\n"              
+                "LDR     R3, [R6]\n"                  
+                "CMP     R3, #1\n"                    
+                "BNE     loc_FF954878\n"              
+                "B       loc_FF954864\n"              
+"loc_FF954860:\n"                                     
+                "LDR     R6, =0x5C950\n"              
+"loc_FF954864:\n"                                     
+                "MOV     R0, R4\n"                    
+                "LDR     R3, =0x5C9E0\n"              
+                "MOV     LR, PC\n"                    
+                "LDR     PC, [R3]\n"                  
+                "STR     R5, [R6]\n"                  
+"loc_FF954878:\n"                                     
+                "LDR     R2, =0x5C94C\n"              
+                "MOV     R3, #0\n"                    
+                "STR     R3, [R2]\n"                  
+"loc_FF954884:\n"                                     
+                                                  
+                "ADD     SP, SP, #0x1C\n"             
+                "LDMFD   SP!, {R4-R8,PC}\n"
+ );
+}
+
+
+void __attribute__((naked,noinline)) sub_FF956A58_my(){
+ asm volatile(
+                "STMFD   SP!, {R4-R11,LR}\n"          
+                "LDR     R12, =0x5CD00\n"             
+                "LDR     R3, =0x5CD18\n"              
+                "SUB     SP, SP, #8\n"                
+                "LDR     R1, [R3]\n"                  
+                "LDR     R2, [R12]\n"                 
+                "LDR     R3, =0x5CD9C\n"              
+                "ADD     R7, R2, #1\n"                
+                "LDR     R3, [R3]\n"                  
+                "CMP     R7, R1\n"                    
+                "STR     R7, [R12]\n"                 
+                "MOV     R11, R0\n"                   
+                "STR     R3, [SP,#4]\n"               
+                "MOVHI   R3, #0\n"                    
+                "STRHI   R3, [R11]\n"                 
+                "MOVHI   R0, #0x80000001\n"           
+                "BHI     loc_FF956E5C\n"              
+                "LDR     R3, =0x5CD80\n"              
+                "LDR     R4, [R3]\n"                  
+                "MOV     R0, R7\n"                    
+                "MOV     R1, R4\n"                    
+                "BL      sub_FFAEA294\n"                 
+                "CMP     R0, #1\n"                    
+                "BNE     loc_FF956CF0\n"              
+                "LDR     R3, =0x5CDA0\n"              
+                "LDR     R1, =0x5CDAC\n"              
+                "LDR     R0, =0x5CCE8\n"              
+                "LDR     R10, [R3]\n"                 
+                "LDR     R2, [R1]\n"                  
+                "LDR     R5, [R0]\n"                  
+                "ADD     R2, R10, R2\n"               
+                "CMP     R2, R5\n"                    
+                "BNE     loc_FF956B0C\n"              
+                "MOV     R1, R4\n"                    
+                "MOV     R0, R7\n"                    
+                "BL      sub_FFAE9C04\n"                 
+                "LDR     R2, =0xAAAAAAAB\n"           
+                "ADD     R0, R0, #1\n"                
+                "UMULL   R1, R3, R2, R0\n"            
+                "MOV     R3, R3,LSR#1\n"              
+                "ADD     R3, R3, R3,LSL#1\n"          
+                "LDR     R4, =0x5CCF0\n"              
+                "RSB     R0, R3, R0\n"                
+                "STR     R10, [R4,R0,LSL#2]\n"        
+                "B       loc_FF956B38\n"              
+"loc_FF956B0C:\n"                                     
+                "MOV     R1, R4\n"                    
+                "MOV     R0, R7\n"                    
+                "BL      sub_FFAE9C04\n"                 
+                "LDR     R2, =0xAAAAAAAB\n"           
+                "ADD     R0, R0, #1\n"                
+                "UMULL   R1, R3, R2, R0\n"            
+                "MOV     R3, R3,LSR#1\n"              
+                "ADD     R3, R3, R3,LSL#1\n"          
+                "LDR     R4, =0x5CCF0\n"              
+                "RSB     R0, R3, R0\n"                
+                "STR     R5, [R4,R0,LSL#2]\n"         
+"loc_FF956B38:\n"                                     
+                "LDR     R3, =0x5CD00\n"              
+                "LDR     R2, =0x5CD80\n"              
+                "LDR     R0, [R3]\n"                  
+                "LDR     R1, [R2]\n"                  
+                "BL      sub_FFAE9C04\n"                 
+                "LDR     R2, =0xAAAAAAAB\n"           
+                "ADD     R0, R0, #1\n"                
+                "UMULL   R1, R3, R2, R0\n"            
+                "MOV     R3, R3,LSR#1\n"              
+                "ADD     R3, R3, R3,LSL#1\n"          
+                "RSB     R0, R3, R0\n"                
+                "LDR     R3, =0x5CCE4\n"              
+                "LDR     R12, [R4,R0,LSL#2]\n"        
+                "LDR     R2, [R3]\n"                  
+                "CMP     R12, R2\n"                   
+                "BHI     loc_FF956B94\n"              
+                "LDR     R4, =0x5CD38\n"              
+                "LDR     R3, [R4]\n"                  
+                "ADD     R3, R12, R3\n"               
+                "ADD     R3, R3, #8\n"                
+                "CMP     R2, R3\n"                    
+                "BCS     loc_FF956B98\n"              
+                "B       loc_FF956D6C\n"              
+"loc_FF956B94:\n"                                     
+                "LDR     R4, =0x5CD38\n"              
+"loc_FF956B98:\n"                                     
+                "LDR     R2, =0x5CDA0\n"              
+                "LDR     R1, =0x5CDAC\n"              
+                "LDR     R0, [R4]\n"                  
+                "LDR     R3, [R1]\n"                  
+                "LDR     LR, [R2]\n"                  
+                "ADD     R0, R12, R0\n"               
+                "ADD     R2, LR, R3\n"                
+                "ADD     R1, R0, #8\n"                
+                "CMP     R1, R2\n"                    
+                "BLS     loc_FF956BE8\n"              
+                "LDR     R3, =0x5CCE4\n"              
+                "RSB     R2, R2, R0\n"                
+                "ADD     R0, R2, #8\n"                
+                "LDR     R1, [R3]\n"                  
+                "ADD     R2, LR, R0\n"                
+                "CMP     R1, R2\n"                    
+                "BCC     loc_FF956D6C\n"              
+                "LDR     R3, =0x5CCE8\n"              
+                "STR     R2, [R3]\n"                  
+                "B       loc_FF956BF0\n"              
+"loc_FF956BE8:\n"                                     
+                "LDR     R3, =0x5CCE8\n"              
+                "STR     R1, [R3]\n"                  
+"loc_FF956BF0:\n"                                     
+                "LDR     R3, [R4]\n"                  
+                "LDR     R12, =0x5CD50\n"             
+                "ADD     R3, R3, #0x18\n"             
+                "LDR     R2, [R12,#4]\n"              
+                "MOV     R0, R3\n"                    
+                "MOV     R1, #0\n"                    
+                "CMP     R1, R2\n"                    
+                "BHI     loc_FF956DAC\n"              
+                "BNE     loc_FF956C20\n"              
+                "LDR     R3, [R12]\n"                 
+                "CMP     R0, R3\n"                    
+                "BHI     loc_FF956DAC\n"              
+"loc_FF956C20:\n"                                     
+                "LDR     R4, [R4]\n"                  
+                "LDR     LR, =0x5CD58\n"              
+                "STR     R4, [SP]\n"                  
+                "LDR     R12, =0x5CD50\n"             
+                "LDR     R3, =0x5CD00\n"              
+                "LDMIA   LR, {R7,R8}\n"               
+                "LDMIA   R12, {R5,R6}\n"              
+                "LDR     R10, [R3]\n"                 
+                "LDR     R2, =0x5CD80\n"              
+                "MOV     R3, R4\n"                    
+                "MOV     R4, #0\n"                    
+                "ADDS    R7, R7, R3\n"                
+                "ADC     R8, R8, R4\n"                
+                "LDR     R9, [R2]\n"                  
+                "SUBS    R5, R5, R3\n"                
+                "SBC     R6, R6, R4\n"                
+                "MVN     R2, #0\n"                    
+                "MVN     R1, #0x17\n"                 
+                "ADDS    R5, R5, R1\n"                
+                "MOV     R4, #0\n"                    
+                "MOV     R3, #0x18\n"                 
+                "ADC     R6, R6, R2\n"                
+                "ADDS    R7, R7, R3\n"                
+                "ADC     R8, R8, R4\n"                
+                "STMIA   R12, {R5,R6}\n"              
+                "SUB     R0, R10, #1\n"               
+                "MOV     R1, R9\n"                    
+                "STMIA   LR, {R7,R8}\n"               
+                "BL      sub_FFAE9C04\n"                 
+                "CMP     R10, #1\n"                   
+                "MLA     R0, R9, R0, R0\n"            
+                "BEQ     loc_FF956CF0\n"              
+                "LDR     R1, [SP,#4]\n"               
+                "SUB     R3, R0, #1\n"                
+                "MOV     R3, R3,LSL#4\n"              
+                "ADD     R4, R1, #0x10\n"             
+                "ADD     R5, R1, #0x14\n"             
+                "LDR     R1, [R5,R3]\n"               
+                "LDR     R2, [R4,R3]\n"               
+                "MOV     R3, R0,LSL#4\n"              
+                "LDR     R0, [SP,#4]\n"               
+                "ADD     R2, R2, R1\n"                
+                "LDR     LR, =0x62773130\n"           
+                "ADD     R1, R0, #8\n"                
+                "ADD     R12, R0, #0xC\n"             
+                "ADD     R2, R2, #8\n"                
+                "MOV     R0, #0\n"                    
+                "STR     LR, [R1,R3]\n"               
+                "STR     R0, [R12,R3]\n"              
+                "STR     R2, [R4,R3]\n"               
+                "LDR     R1, [SP]\n"                  
+                "STR     R1, [R5,R3]\n"               
+"loc_FF956CF0:\n"                                     
+                                                  
+                "LDR     R2, =0x5CCE8\n"              
+                "LDR     R3, [R2]\n"                  
+                "ADD     R1, R3, #8\n"                
+                "STR     R1, [R11]\n"                 
+                "LDR     R0, =0x5CCE4\n"              
+                "LDR     R2, [R0]\n"                  
+                "CMP     R3, R2\n"                    
+                "BHI     loc_FF956D28\n"              
+                "LDR     LR, =0x5CD48\n"              
+                "LDR     R3, [LR]\n"                  
+                "ADD     R3, R1, R3\n"                
+                "CMP     R2, R3\n"                    
+                "BCS     loc_FF956D2C\n"              
+                "B       loc_FF956D6C\n"              
+"loc_FF956D28:\n"                                     
+                "LDR     LR, =0x5CD48\n"              
+"loc_FF956D2C:\n"                                     
+                "LDR     R3, =0x5CDA0\n"              
+                "LDR     R2, =0x5CDAC\n"              
+                "LDR     R12, [R3]\n"                 
+                "LDR     R0, [R2]\n"                  
+                "LDR     R1, [R11]\n"                 
+                "LDR     R3, [LR]\n"                  
+                "ADD     R2, R1, R3\n"                
+                "ADD     R1, R12, R0\n"               
+                "CMP     R2, R1\n"                    
+                "BLS     loc_FF956D7C\n"              
+                "RSB     R0, R1, R2\n"                
+                "LDR     R1, =0x5CCE4\n"              
+                "LDR     R2, [R1]\n"                  
+                "ADD     R3, R12, R0\n"               
+                "CMP     R2, R3\n"                    
+                "BCS     loc_FF956D7C\n"              
+"loc_FF956D6C:\n"                                     
+                                                  
+                "MOV     R3, #0\n"                    
+                "STR     R3, [R11]\n"                 
+                "MOV     R0, #0x80000003\n"           
+                "B       loc_FF956E5C\n"              
+"loc_FF956D7C:\n"                                     
+                                                  
+                "LDR     R3, [LR]\n"                  
+                "LDR     R12, =0x5CD50\n"             
+                "ADD     R3, R3, #0x18\n"             
+                "LDR     R2, [R12,#4]\n"              
+                "MOV     R0, R3\n"                    
+                "MOV     R1, #0\n"                    
+                "CMP     R1, R2\n"                    
+                "BHI     loc_FF956DAC\n"              
+                "BNE     loc_FF956DBC\n"              
+                "LDR     R3, [R12]\n"                 
+                "CMP     R0, R3\n"                    
+                "BLS     loc_FF956DBC\n"              
+"loc_FF956DAC:\n"                                     
+                                                  
+                "MOV     R3, #0\n"                    
+                "STR     R3, [R11]\n"                 
+                "MOV     R0, #0x80000005\n"           
+                "B       loc_FF956E5C\n"              
+"loc_FF956DBC:\n"                                     
+                                                  
+                "LDR     R1, =0x5CD30\n"              
+                "LDR     R0, =0x5CD80\n"              
+                "LDR     R3, [R1]\n"                  
+                "LDR     R2, [R0]\n"                  
+                "ADD     R3, R3, R2,LSL#4\n"          
+                "ADD     R3, R3, R3,LSL#2\n"          
+                "LDR     R12, =0x5CD50\n"             
+                "MOV     R3, R3,LSL#1\n"              
+                "ADD     R3, R3, #0xA0\n"             
+                "LDR     R2, [R12,#4]\n"              
+                "MOV     R0, R3\n"                    
+                "MOV     R1, #0\n"                    
+                "CMP     R1, R2\n"                    
+                "BHI     loc_FF956E04\n"              
+                "BNE     loc_FF956E28\n"              
+                "LDR     R3, [R12]\n"                 
+                "CMP     R0, R3\n"                    
+                "BLS     loc_FF956E28\n"              
+"loc_FF956E04:\n"                                     
+                "LDR     R4, =0x5CD68\n"              
+                "LDR     R1, [R4]\n"                  
+                "CMP     R1, #0\n"                    
+                "BNE     loc_FF956E28\n"              
+                "MOV     R0, #0x3140\n"               
+                "ADD     R0, R0, #8\n"                
+                "BL      sub_FF9801E4\n"              
+                "MOV     R3, #1\n"                    
+                "STR     R3, [R4]\n"                  
+"loc_FF956E28:\n"                                     
+                                                  
+                "LDR     R2, =0x5CD58\n"              
+                "LDR     R3, [R2,#4]\n"               
+                "CMP     R3, #0\n"                    
+                "BHI     loc_FF956E48\n"              
+                "BNE     loc_FF956E58\n"              
+                "LDR     R3, [R2]\n"                  
+                "CMP     R3, #0x40000000\n"           
+            //  "BLS     loc_FF956E58\n"     // -
+
+                "B       loc_FF956E58\n"     // +
+
+"loc_FF956E48:\n"                                     
+                "MOV     R3, #0\n"                    
+                "STR     R3, [R11]\n"                 
+                "MOV     R0, #0x80000007\n"           
+                "B       loc_FF956E5C\n"              
+"loc_FF956E58:\n"                                     
+                                                  
+                "MOV     R0, #0\n"                    
+"loc_FF956E5C:\n"                                     
+                                                  
+                "ADD     SP, SP, #8\n"                
+                "LDMFD   SP!, {R4-R11,PC}\n"          
+ );
+}
+
+
+void __attribute__((naked,noinline)) sub_FF95593C_my(){
+ asm volatile(
+                "CMP     R2, #1\n"                    
+                "STMFD   SP!, {R4-R7,LR}\n"           
+                "MOV     R7, R0\n"                    
+                "MOV     R6, R1\n"                    
+                "LDREQ   R3, =CompressionRateTable\n" 
+                "LDREQ   R2, [R3]\n"                  
+                "STREQ   R2, [R6]\n"                  
+                "LDMEQFD SP!, {R4-R7,PC}\n"           
+                "LDR     R12, =0x5CA60\n"             
+                "LDR     R0, [R12]\n"                 
+                "LDR     R3, =0x5CA68\n"              
+                "CMP     R0, #0\n"                    
+                "LDR     R1, [R3]\n"                  
+                "BEQ     loc_FF955988\n"              
+                "LDR     R2, =0x5CA6C\n"              
+                "LDR     R3, [R2]\n"                  
+                "CMP     R3, #1\n"                    
+                "BNE     loc_FF95599C\n"              
+                "B       loc_FF95598C\n"              
+"loc_FF955988:\n"                                     
+                "LDR     R2, =0x5CA6C\n"              
+"loc_FF95598C:\n"                                     
+                "MOV     R3, #0\n"                    
+                "STR     R3, [R2]\n"                  
+                "STR     R7, [R12]\n"                 
+                "B       loc_FF955A50\n"              
+"loc_FF95599C:\n"                                     
+                "LDR     R3, =0x5CA64\n"              
+                "LDR     R2, [R3]\n"                  
+                "LDR     R5, =table1\n"   // + 0xFF955710      
+                "MOV     LR, R2,LSL#2\n"              
+                "LDR     R3, [R5,LR]\n"               
+                "LDR     R4, =table2\n"   // + 0xFF9557F0      
+                "RSB     R12, R3, R0\n"               
+                "LDR     R2, [R4,LR]\n"               
+                "CMP     R12, #0\n"                   
+                "RSB     R0, R2, R0\n"                
+                "BLE     loc_FF9559FC\n"              
+                "ADD     R3, R5, #0x10\n"             
+                "LDR     R2, [R3,LR]\n"               
+                "CMP     R2, R12\n"                   
+                "ADDGE   R1, R1, #1\n"                
+                "BGE     loc_FF9559F0\n"              
+                "ADD     R3, R5, #0x20\n"             
+                "LDR     R2, [R3,LR]\n"               
+                "CMP     R2, R12\n"                   
+                "ADDGE   R1, R1, #2\n"                
+                "ADDLT   R1, R1, #3\n"                
+"loc_FF9559F0:\n"                                     
+           //   "CMP     R1, #0xE\n"    // -            
+           //   "MOVGE   R1, #0xE\n"    // -            
+                "CMP     R1, #0x1A\n"   // +            
+                "MOVGE   R1, #0x1A\n"   // +            
+
+                "B       loc_FF955A34\n"              
+"loc_FF9559FC:\n"                                     
+                "CMP     R0, #0\n"                    
+                "BGE     loc_FF955A34\n"              
+                "ADD     R3, R4, #0x10\n"             
+                "LDR     R2, [R3,LR]\n"               
+                "CMP     R2, R0\n"                    
+                "SUBLE   R1, R1, #1\n"                
+                "BLE     loc_FF955A2C\n"              
+                "ADD     R3, R4, #0x20\n"             
+                "LDR     R2, [R3,LR]\n"               
+                "CMP     R2, R0\n"                    
+                "SUBLE   R1, R1, #2\n"                
+                "SUBGT   R1, R1, #3\n"                
+"loc_FF955A2C:\n"                                     
+                "CMP     R1, #0\n"                    
+                "MOVLT   R1, #0\n"                    
+"loc_FF955A34:\n"                                     
+                                                  
+                "LDR     R0, =0x5CA68\n"              
+                "LDR     R3, [R0]\n"                  
+                "CMP     R1, R3\n"                    
+                "LDRNE   R2, =0x5CA6C\n"              
+                "MOVNE   R3, #1\n"                    
+                "STRNE   R1, [R0]\n"                  
+                "STRNE   R3, [R2]\n"                  
+"loc_FF955A50:\n"                                     
+                "LDR     R3, =0x5CA68\n"              
+             // "LDR     R1, =0x5658\n"    //
+                "LDR     R1, =video_mode\n" //+        
+                "LDR     R0, [R3]\n"                  
+                "LDR     R2, =CompressionRateTable\n" 
+                "LDR     R12, [R1]\n"
+                "LDR     R12, [R12]\n" //+                
+                "LDR     LR, [R2,R0,LSL#2]\n"         
+                "LDR     R3, =0x5CA60\n"              
+                "CMP     R12, #1\n"                   
+                "STR     R7, [R3]\n"                  
+                "STR     LR, [R6]\n"                  
+//              "MOVEQ   R3, #0xB\n"         // -
+
+                "LDREQ   R3, =video_quality\n"          // +
+                "LDREQ   R3, [R3]\n"                    // +
+                "LDREQ   R3, [R3]\n"                    // +
+
+                "STREQ   R3, [R6]\n"                  
+                "LDMFD   SP!, {R4-R7,PC}\n"           
+ );
+}
+
Index: /trunk/platform/s2is/sub/100f/stubs_auto.S
===================================================================
--- /trunk/platform/s2is/sub/100f/stubs_auto.S	(revision 511)
+++ /trunk/platform/s2is/sub/100f/stubs_auto.S	(revision 511)
@@ -0,0 +1,96 @@
+/* THIS FILE IS GENERATED */
+/* DO NOT EDIT THIS FILE! */
+
+#include "stubs_asm.h"
+
+STUB(FF811298)
+STUB(FF811384)
+STUB(FF811444)
+STUB(FF8117DC)
+STUB(FF811800)
+STUB(FF8118C0)
+STUB(FF811A40)
+STUB(FF811A9C)
+STUB(FF811AA8)
+STUB(FF811ACC)
+STUB(FF811AEC)
+STUB(FF811B18)
+STUB(FF813D58)
+STUB(FF82072C)
+STUB(FF8208C8)
+STUB(FF820F34)
+STUB(FF82134C)
+STUB(FF821B6C)
+STUB(FF821D54)
+STUB(FF82275C)
+STUB(FF825F00)
+STUB(FF829978)
+STUB(FF8299D8)
+STUB(FF82A37C)
+STUB(FF8319D0)
+STUB(FF8A5368)
+STUB(FF8A5414)
+STUB(FF953B70)
+STUB(FF953BAC)
+STUB(FF953FE4)
+STUB(FF954238)
+STUB(FF9546EC)
+STUB(FF9548CC)
+STUB(FF954954)
+STUB(FF9549A4)
+STUB(FF954B84)
+STUB(FF954D50)
+STUB(FF954E30)
+STUB(FF954E9C)
+STUB(FF955060)
+STUB(FF9551F0)
+STUB(FF95593C)
+STUB(FF956A58)
+STUB(FF956EAC)
+STUB(FF957194)
+STUB(FF96A094)
+STUB(FF96A964)
+STUB(FF96ADF4)
+STUB(FF96BD64)
+STUB(FF96C034)
+STUB(FF96C218)
+STUB(FF96D224)
+STUB(FF96D9A8)
+STUB(FF96DA58)
+STUB(FF96DB50)
+STUB(FF96DCC8)
+STUB(FF96DFB8)
+STUB(FF96E054)
+STUB(FF96E61C)
+STUB(FF96E6B0)
+STUB(FF96E7F4)
+STUB(FF96EAEC)
+STUB(FF96EBD0)
+STUB(FF96EC88)
+STUB(FF96EF94)
+STUB(FF96F00C)
+STUB(FF96F058)
+STUB(FF96F0C0)
+STUB(FF96F518)
+STUB(FF96F5A8)
+STUB(FF96F5F0)
+STUB(FF96F86C)
+STUB(FF96FEEC)
+STUB(FF97AE20)
+STUB(FF97AE2C)
+STUB(FF97C2B4)
+STUB(FF9801E4)
+STUB(FFADC138)
+STUB(FFAE9C04)
+STUB(FFAEA294)
+STUB(FFAEFA60)
+STUB(FFAEFF60)
+STUB(FFAF21BC)
+STUB(FFAF60DC)
+STUB(FFAF6B54)
+STUB(FFAF83B8)
+STUB(FFAF8AF8)
+STUB(FFAFE09C)
+STUB(FFAFF9AC)
+STUB(FFB0276C)
+STUB(FFB072EC)
Index: /trunk/platform/s2is/sub/100f/Makefile
===================================================================
--- /trunk/platform/s2is/sub/100f/Makefile	(revision 511)
+++ /trunk/platform/s2is/sub/100f/Makefile	(revision 511)
@@ -0,0 +1,6 @@
+topdir=../../../../
+
+OBJS=boot.o stubs_min.o stubs_auto.o stubs_entry.o lib.o stubs_entry_2.o capt_seq.o movie_rec.o
+STUBS_AUTO_DEPS=boot.c capt_seq.c movie_rec.c
+
+include $(topdir)/platform/makefile_sub.inc
Index: /trunk/platform/s2is/sub/100g/capt_seq.c
===================================================================
--- /trunk/platform/s2is/sub/100g/capt_seq.c	(revision 511)
+++ /trunk/platform/s2is/sub/100g/capt_seq.c	(revision 511)
@@ -0,0 +1,286 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+#define RAWDATA_AVAILABLE (1)
+#define RAWDATA_SAVED (2)
+
+#define NR_ON (1)
+#define NR_OFF (0)
+
+static long raw_save_stage;
+
+void capt_seq_hook_raw_here()
+{
+    raw_save_stage = RAWDATA_AVAILABLE;
+    core_rawdata_available();
+    while (raw_save_stage != RAWDATA_SAVED){
+	_SleepTask(10);
+    }
+}
+
+void hook_raw_save_complete()
+{
+    raw_save_stage = RAWDATA_SAVED;
+}
+
+
+void capt_seq_hook_set_nr()
+{
+    long *nrflag = (long*)0x5754;
+
+    switch (core_get_noise_reduction_value()){
+    case NOISE_REDUCTION_AUTO_CANON:
+	// leave it alone
+	break;
+    case NOISE_REDUCTION_OFF:
+	*nrflag = 0;
+	break;
+    case NOISE_REDUCTION_ON:
+	*nrflag = 1;
+	break;
+    };
+}
+
+
+void __attribute__((naked,noinline)) sub_FF96F334_my(long p)
+{
+    asm volatile (
+                "STMFD   SP!, {R4-R8,LR}\n"
+                "LDR     R3, =0x574C\n"
+                "SUB     SP, SP, #4\n"
+                "LDR     R2, [R3]\n"
+                "LDR     R4, =0x5750\n"
+                "CMP     R2, #0\n"
+                "STR     R0, [R4]\n"
+                "MOV     R8, #0\n"
+                "LDR     R6, =0xFF96F26C\n"
+                "BNE     loc_FF96F368\n"
+                "LDR     R0, =0xFF96F328\n"
+                "MOV     R1, #0xDB\n"
+                "BL      sub_FF813D58\n"
+"loc_FF96F368:\n"
+                "LDR     R3, =0x5D184\n"
+                "LDR     R1, =0xFFFFFFFF\n"
+                "LDR     R0, [R3]\n"
+                "BL      sub_FF8208C8\n"
+                "BL      sub_FF96F2A4\n"
+          //  "BL      wait_until_remote_button_is_released\n"
+	    	"BL      capt_seq_hook_set_nr\n"
+                "B       sub_FF96F37C\n"
+    );
+}
+
+void __attribute__((naked,noinline)) sub_FF96BDC0_my(long p)
+{
+    asm volatile (
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "LDR     R5, [R0,#8]\n"
+                "BL      sub_FF97ABAC\n"
+                "CMP     R0, #0\n"
+                "LDR     R0, =0xFF96BD9C\n"
+                "BNE     loc_FF96BDE0\n"
+                "BL      sub_FFAF1F48\n"
+                "BL      sub_FF97ABB8\n"
+"loc_FF96BDE0:\n"
+                "BL      sub_FF969E20\n"
+                "ADD     R3, R5, R5,LSL#1\n"
+                "RSB     R3, R5, R3,LSL#3\n"
+                "MOV     R6, R3,LSL#2\n"
+                "ADD     R0, R6, R0\n"
+                "LDR     R3, [R0,#8]\n"
+                "CMP     R3, #0\n"
+                "BEQ     loc_FF96BE04\n"
+                "BL      sub_FF9538FC\n"
+"loc_FF96BE04:\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FF96DDE0\n"
+                "TST     R0, #1\n"
+                "MOV     R2, R5\n"
+                "MOV     R1, #1\n"
+                "BEQ     loc_FF96BE24\n"
+                "LDMFD   SP!, {R4-R6,LR}\n"
+                "B       sub_FF96AB80\n"
+"loc_FF96BE24:\n"
+                "BL      sub_FF969E20\n"
+                "MOV     R4, R0\n"
+                "BL      sub_FF825F00\n"
+                "ADD     R4, R6, R4\n"
+                "STR     R0, [R4,#4]\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FF96FC78\n"
+                "BL      sub_FF96E43C\n"
+                "BL      sub_FF96E3A8\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FF96F334_my\n"
+                "BL      capt_seq_hook_raw_here\n"
+                "MOV     R2, R5\n"
+                "MOV     R1, #1\n"
+                "BL      sub_FF96AB80\n"
+                "BL      sub_FF96F5F8\n"
+                "BL      sub_FF969E20\n"
+                "ADD     R0, R6, R0\n"
+                "LDR     R3, [R0,#8]\n"
+                "CMP     R3, #0\n"
+                "LDMEQFD SP!, {R4-R6,PC}\n"
+                "LDMFD   SP!, {R4-R6,LR}\n"
+                "B       sub_FF953938\n"
+
+    );
+}
+
+void __attribute__((naked,noinline)) capt_seq_task()
+{
+	asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                "SUB     SP, SP, #4\n"
+                "MOV     R4, SP\n"
+                "B       loc_FF96C93C\n"
+"loc_FF96C78C:\n"
+                "LDR     R0, [SP,#0xC-0xC]\n"
+                "LDR     R3, [R0]\n"
+                "CMP     R3, #0x11\n"
+                "LDRLS   PC, [PC,R3,LSL#2]\n"
+                "B       loc_FF96C924\n"
+                ".long loc_FF96C7E8\n"
+                ".long loc_FF96C7F8\n"
+                ".long loc_FF96C80C\n"
+                ".long loc_FF96C81C\n"
+                ".long loc_FF96C82C\n"
+                ".long loc_FF96C83C\n"
+                ".long loc_FF96C850\n"
+                ".long loc_FF96C860\n"
+                ".long loc_FF96C874\n"
+                ".long loc_FF96C884\n"
+                ".long loc_FF96C894\n"
+                ".long loc_FF96C8A4\n"
+                ".long loc_FF96C8B4\n"
+                ".long loc_FF96C8C8\n"
+                ".long loc_FF96C8D8\n"
+                ".long loc_FF96C8E8\n"
+                ".long loc_FF96C8F8\n"
+                ".long loc_FF96C90C\n"
+"loc_FF96C7E8:\n"
+                "BL      sub_FF96CFB0\n"
+                "LDR     R3, =0x5D11C\n"
+                "MOV     R1, #8\n"
+                "B       loc_FF96C918\n"
+"loc_FF96C7F8:\n"
+                "BL      sub_FF96D734\n"
+                "BL      shooting_expo_param_override\n"  // +
+                "BL      sub_FF96A6F0\n"
+                "LDR     R3, =0x5D11C\n"
+                "MOV     R1, #0x10\n"
+                "B       loc_FF96C918\n"
+"loc_FF96C80C:\n"
+                "BL      sub_FF96BDC0_my\n"
+                "LDR     R3, =0x5D11C\n"
+                "MOV     R1, #2\n"
+                "B       loc_FF96C918\n"
+"loc_FF96C81C:\n"
+                "BL      sub_FF96DD44\n"
+                "LDR     R3, =0x5D11C\n"
+                "MOV     R1, #1\n"
+                "B       loc_FF96C918\n"
+"loc_FF96C82C:\n"
+                "BL      sub_FF96D7E4\n"
+                "LDR     R3, =0x5D11C\n"
+                "MOV     R1, #0x20\n"
+                "B       loc_FF96C918\n"
+"loc_FF96C83C:\n"
+                "BL      sub_FF96D8DC\n"
+                "BL      sub_FF96A6F0\n"
+                "LDR     R3, =0x5D11C\n"
+                "MOV     R1, #0x40\n"
+                "B       loc_FF96C918\n"
+"loc_FF96C850:\n"
+                "BL      sub_FF96BFA4\n"
+                "LDR     R3, =0x5D11C\n"
+                "MOV     R1, #0x80\n"
+                "B       loc_FF96C918\n"
+"loc_FF96C860:\n"
+                "BL      sub_FF96DA54\n"
+                "BL      sub_FF96A6F0\n"
+                "LDR     R3, =0x5D11C\n"
+                "MOV     R1, #0x400\n"
+                "B       loc_FF96C918\n"
+"loc_FF96C874:\n"
+                "BL      sub_FF96D7E4\n"
+                "LDR     R3, =0x5D11C\n"
+                "MOV     R1, #0x800\n"
+                "B       loc_FF96C918\n"
+"loc_FF96C884:\n"
+                "BL      sub_FF96E580\n"
+                "LDR     R3, =0x5D11C\n"
+                "MOV     R1, #0x8000\n"
+                "B       loc_FF96C918\n"
+"loc_FF96C894:\n"
+                "BL      sub_FF96E95C\n"
+                "LDR     R3, =0x5D11C\n"
+                "MOV     R1, #0x10000\n"
+                "B       loc_FF96C918\n"
+"loc_FF96C8A4:\n"
+                "BL      sub_FF96E878\n"
+                "LDR     R3, =0x5D11C\n"
+                "MOV     R1, #0x20000\n"
+                "B       loc_FF96C918\n"
+"loc_FF96C8B4:\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF96EA14\n"
+                "LDR     R3, =0x5D11C\n"
+                "MOV     R1, #0x40000\n"
+                "B       loc_FF96C918\n"
+"loc_FF96C8C8:\n"
+                "BL      sub_FF96ED20\n"
+                "LDR     R3, =0x5D11C\n"
+                "MOV     R1, #0x80000\n"
+                "B       loc_FF96C918\n"
+"loc_FF96C8D8:\n"
+                "BL      sub_FF96ED98\n"
+                "LDR     R3, =0x5D11C\n"
+                "MOV     R1, #0x100000\n"
+                "B       loc_FF96C918\n"
+"loc_FF96C8E8:\n"
+                "BL      sub_FF96EDE4\n"
+                "LDR     R3, =0x5D11C\n"
+                "MOV     R1, #0x200000\n"
+                "B       loc_FF96C918\n"
+"loc_FF96C8F8:\n"
+                "MOV     R0, #1\n"
+                "BL      sub_FF96EA14\n"
+                "LDR     R3, =0x5D11C\n"
+                "MOV     R1, #0x400000\n"
+                "B       loc_FF96C918\n"
+"loc_FF96C90C:\n"
+                "BL      sub_FF96EE4C\n"
+                "LDR     R3, =0x5D11C\n"
+                "MOV     R1, #0x800000\n"
+"loc_FF96C918:\n"
+                "LDR     R0, [R3]\n"
+                "BL      sub_FF82072C\n"
+                "B       loc_FF96C934\n"
+"loc_FF96C924:\n"
+                "MOV     R1, #0x374\n"
+                "LDR     R0, =0xFF96BA70\n"
+                "ADD     R1, R1, #2\n"
+                "BL      sub_FF813D58\n"
+"loc_FF96C934:\n"
+                "LDR     R0, [SP,#0xC-0xC]\n"
+                "BL      sub_FF96BAF0\n"
+"loc_FF96C93C:\n"
+                "LDR     R3, =0x5D120\n"
+                "MOV     R1, R4\n"
+                "LDR     R0, [R3]\n"
+                "MOV     R2, #0\n"
+                "BL      sub_FF820F34\n"
+                "TST     R0, #1\n"
+                "BEQ     loc_FF96C78C\n"
+                "LDR     R0, =0xFF96BA70\n"
+                "MOV     R1, #0x2EC\n"
+                "BL      sub_FF813D58\n"
+                "BL      sub_FF82275C\n"
+                "ADD     SP, SP, #4\n"
+                "LDMFD   SP!, {R4,PC}\n"
+	);
+}
+
Index: /trunk/platform/s2is/sub/100g/stubs_entry.S
===================================================================
--- /trunk/platform/s2is/sub/100g/stubs_entry.S	(revision 511)
+++ /trunk/platform/s2is/sub/100g/stubs_entry.S	(revision 511)
@@ -0,0 +1,180 @@
+// !!! THIS FILE IS GENERATED. DO NOT EDIT. !!!
+#include "stubs_asm.h"
+
+// Best match: 79%
+NSTUB(AllocateMemory, 0xff811ba0)
+NSTUB(AllocateUncacheableMemory, 0xff814810)
+// ERROR: Close is not found!
+NSTUB(CreatePhysicalVram, 0xff93e258)
+NSTUB(CreateTask, 0xff82239c)
+NSTUB(CreateTaskStrict, 0xff823964)
+NSTUB(DisableDispatch, 0xff82210c)
+// ERROR: DisplayImagePhysicalScreen is not found!
+NSTUB(EnableDispatch, 0xff822198)
+NSTUB(ExecuteEventProcedure, 0xff816ab4)
+NSTUB(ExitTask, 0xff82275c)
+NSTUB(Fclose_Fut, 0xff86fac0)
+NSTUB(Fopen_Fut, 0xff86fa84)
+NSTUB(Fread_Fut, 0xff86fba4)
+// Best match: 66%
+NSTUB(FreeMemory, 0xff811bac)
+NSTUB(FreeUncacheableMemory, 0xff814844)
+NSTUB(Fseek_Fut, 0xff86fc8c)
+NSTUB(Fwrite_Fut, 0xff86fbf4)
+NSTUB(GetCurrentAvValue, 0xffaa6ad0)
+// ALT: NSTUB(GetCurrentAvValue, 0xffaa8a84) // 13/0
+NSTUB(GetCurrentTargetDistance, 0xffaa8a2c)
+// Best match: 87%
+NSTUB(GetFocusLensSubjectDistance, 0xffa8e778)
+// ALT: NSTUB(GetFocusLensSubjectDistance, 0xffa8e778) // 27/4
+// ERROR: GetFocusLensSubjectDistanceFromLens is not found!
+// Best match: 76%
+NSTUB(GetParameterData, 0xff987d44)
+// ALT: NSTUB(GetParameterData, 0xff987d44) // 23/7
+// Best match: 71%
+NSTUB(GetPropertyCase, 0xff825d04)
+// Best match: 96%
+NSTUB(GetSystemTime, 0xff814b98)
+// ALT: NSTUB(GetSystemTime, 0xff814b98) // 26/1
+// Best match: 68%
+NSTUB(GetZoomLensCurrentPoint, 0xffa87f80)
+// ALT: NSTUB(GetZoomLensCurrentPoint, 0xffa87f80) // 20/9
+// Best match: 51%
+NSTUB(GetZoomLensCurrentPosition, 0xffa87f94)
+// ALT: NSTUB(GetZoomLensCurrentPosition, 0xffa87f94) // 15/14
+NSTUB(IsStrobeChargeCompleted, 0xff912c6c)
+// Best match: 96%
+NSTUB(LockMainPower, 0xff983254)
+// Best match: 70%
+NSTUB(MakeDirectory, 0xff87733c)
+// ERROR: Mount_FileSystem is not found!
+// Best match: 96%
+NSTUB(MoveFocusLensToDistance, 0xffaa8cbc)
+// ERROR: MoveZoomLensWithPoint is not found!
+// ERROR: Open is not found!
+// ERROR: PhySw_testgpio is not found!
+NSTUB(ProtectFile, 0xff86f0ec)
+// Best match: 92%
+NSTUB(PutInNdFilter, 0xffaa6ae4)
+// ALT: NSTUB(PutInNdFilter, 0xffaa6ae4) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffaa6b2c) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffaa6b2c) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffaa6ef4) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffaa6ef4) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffaa8688) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffaa8688) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffaa86d0) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffaa86d0) // 25/2
+// Best match: 94%
+NSTUB(PutOutNdFilter, 0xffaa6f3c)
+// ALT: NSTUB(PutOutNdFilter, 0xffaa6f3c) // 16/1
+// ERROR: Read is not found!
+NSTUB(RefreshPhysicalScreen, 0xff998640)
+// ERROR: Remove is not found!
+// Best match: 96%
+NSTUB(SetAutoShutdownTime, 0xff98314c)
+// Best match: 66%
+NSTUB(SetParameterData, 0xff987d40)
+// ERROR: SetPropertyCase is not found!
+NSTUB(SleepTask, 0xff8221fc)
+// ALT: NSTUB(SleepTask, 0xff8222b0) // 31/0
+NSTUB(TakeSemaphore, 0xff821b6c)
+// Best match: 96%
+NSTUB(UnlockMainPower, 0xff983308)
+NSTUB(Unmount_FileSystem, 0xff876060)
+// ERROR: UnsetZoomForMovie is not found!
+// Best match: 96%
+NSTUB(UpdateMBROnFlash, 0xff87620c)
+// ERROR: VbattGet is not found!
+// ERROR: Write is not found!
+NSTUB(_log, 0xffae084c)
+// ALT: NSTUB(_log, 0xffae084c) // 27/0
+NSTUB(_log10, 0xffae0ef4)
+// ALT: NSTUB(_log10, 0xffae0ef4) // 27/0
+NSTUB(_pow, 0xffae13e4)
+// ALT: NSTUB(_pow, 0xffae13e4) // 25/0
+NSTUB(_sqrt, 0xffae5730)
+// ALT: NSTUB(_sqrt, 0xffae5730) // 24/0
+NSTUB(chdir, 0xffaf498c)
+// ALT: NSTUB(chdir, 0xffaf498c) // 27/0
+NSTUB(close, 0xffaf42cc)
+NSTUB(closedir, 0xffaf026c)
+// ERROR: free is not found!
+NSTUB(ints_disable, 0xff81e254)
+NSTUB(ints_enable, 0xff81e260)
+NSTUB(ioctl, 0xffaf440c)
+NSTUB(iosDevAdd, 0xffaf54ec)
+NSTUB(iosDrvInstall, 0xffaf57b0)
+NSTUB(isalpha, 0xffaea1e0)
+// ALT: NSTUB(isalpha, 0xffaea1e0) // 4/0
+NSTUB(isdigit, 0xffaea210)
+// ALT: NSTUB(isdigit, 0xffaea210) // 4/0
+NSTUB(islower, 0xffaea240)
+// ALT: NSTUB(islower, 0xffaea240) // 4/0
+NSTUB(isspace, 0xffaea288)
+// ALT: NSTUB(isspace, 0xffaea288) // 4/0
+NSTUB(isupper, 0xffaea2a0)
+// ALT: NSTUB(isupper, 0xffaea2a0) // 4/0
+// ERROR: kbd_p1_f is not found!
+// ERROR: kbd_p1_f_cont is not found!
+// ERROR: kbd_p2_f is not found!
+// Best match: 83%
+NSTUB(kbd_pwr_off, 0xff82b0d4)
+// ALT: NSTUB(kbd_pwr_off, 0xff82b0f0) // 5/1
+// Best match: 55%
+NSTUB(kbd_pwr_on, 0xff94003c)
+// ALT: NSTUB(kbd_pwr_on, 0xff940068) // 5/4
+// ERROR: kbd_read_keys_r2 is not found!
+// Best match: 93%
+NSTUB(localtime, 0xffaeea60)
+NSTUB(lseek, 0xffaf4410)
+// Best match: 53%
+NSTUB(malloc, 0xffaf730c)
+// ALT: NSTUB(malloc, 0xffaf730c) // 15/13
+NSTUB(memcmp, 0xffaede40)
+// ALT: NSTUB(memcmp, 0xffafc228) // 9/0
+NSTUB(memcpy, 0xffaede7c)
+NSTUB(memset, 0xffaedef4)
+// Best match: 61%
+NSTUB(mkdir, 0xff877288)
+// ALT: NSTUB(mkdir, 0xff877348) // 19/12
+NSTUB(open, 0xffaf4910)
+NSTUB(opendir, 0xffaf02a0)
+NSTUB(qsort, 0xffaed6a0)
+NSTUB(rand, 0xffaed6c4)
+// ALT: NSTUB(rand, 0xffaed6c4) // 8/0
+NSTUB(read, 0xffaf432c)
+NSTUB(readdir, 0xffaf0238)
+NSTUB(rename, 0xffaf4918)
+// ALT: NSTUB(rename, 0xffaf4918) // 26/0
+NSTUB(rewinddir, 0xffaf0260)
+NSTUB(srand, 0xffaed6e8)
+// ALT: NSTUB(srand, 0xffaed6e8) // 4/0
+NSTUB(stat, 0xffaf0334)
+NSTUB(strcat, 0xffaedf14)
+NSTUB(strchr, 0xffaedf40)
+NSTUB(strcmp, 0xffaedf64)
+NSTUB(strcpy, 0xffaee0f8)
+NSTUB(strlen, 0xffaee25c)
+NSTUB(strncmp, 0xffaee2c0)
+NSTUB(strncpy, 0xffaee304)
+// ALT: NSTUB(strncpy, 0xffaee304) // 24/0
+NSTUB(strpbrk, 0xffaee34c)
+NSTUB(strrchr, 0xffaee388)
+// ALT: NSTUB(strrchr, 0xffaee388) // 8/0
+NSTUB(strtol, 0xffaedadc)
+NSTUB(taskCreateHookAdd, 0xffafa98c)
+NSTUB(taskDeleteHookAdd, 0xffafa8c8)
+// Best match: 82%
+NSTUB(taskIdListGet, 0xffb02470)
+NSTUB(taskLock, 0xffb02b2c)
+NSTUB(taskName, 0xffb02368)
+NSTUB(taskResume, 0xffb0274c)
+NSTUB(taskSuspend, 0xffb02578)
+NSTUB(taskUnlock, 0xffb02bd4)
+NSTUB(time, 0xffaef7ac)
+// ALT: NSTUB(time, 0xffaef7ac) // 25/0
+NSTUB(utime, 0xffaf03c8)
+// ALT: NSTUB(utime, 0xffaf03c8) // 26/0
+NSTUB(vsprintf, 0xffaf1b8c)
+NSTUB(write, 0xffaf439c)
Index: /trunk/platform/s2is/sub/100g/stubs_entry_2.S
===================================================================
--- /trunk/platform/s2is/sub/100g/stubs_entry_2.S	(revision 511)
+++ /trunk/platform/s2is/sub/100g/stubs_entry_2.S	(revision 511)
@@ -0,0 +1,42 @@
+#include "stubs_asm.h"
+
+NHSTUB(Close, 0xFF877100)
+NHSTUB(Remove, 0xFF87710C)
+NHSTUB(DisplayImagePhysicalScreen, 0xFF93DA14)
+NHSTUB(free, 0xFFAF7318)
+NHSTUB(Open, 0xFF8770F4)
+NHSTUB(Read, 0xFF877160)
+NHSTUB(Write, 0xFF87716C)
+NHSTUB(VbattGet, 0xFF82D570)
+NHSTUB(Mount_FileSystem, 0xFF875FF0)
+NHSTUB(SetParameterData, 0xFF987C70)
+NHSTUB(GetPropertyCase, 0xFF825D08)
+NHSTUB(SetPropertyCase, 0xFF825C00)
+NHSTUB(GetZoomLensCurrentPosition, 0xFFAA85C4)
+NHSTUB(GetZoomLensCurrentPoint, 0xFFAA85B0)
+NHSTUB(MoveZoomLensWithPoint, 0xFFA87D8C)
+NHSTUB(SetZoomActuatorSpeedPercent, 0xFFA87F04)
+
+NHSTUB(kbd_p1_f, 0xFF829470)
+NHSTUB(kbd_p1_f_cont, 0xFF829484)
+NHSTUB(kbd_read_keys_r2, 0xFF829E58)
+NHSTUB(platformsub_kbd_fetch_data, 0xFF829F8C)
+NHSTUB(kbd_p2_f, 0xFF829364)
+
+// null stubs
+NHSTUB(PhySw_testgpio, 0xFF8118C0)
+NHSTUB(UnsetZoomForMovie, 0xFF8118C0)
+
+NHSTUB(UniqueLedOn, 0xFF82EBDC)
+NHSTUB(UniqueLedOff, 0xFF82EC54)
+
+NHSTUB(GetDrive_ClusterSize, 0xFF87652C)
+NHSTUB(GetDrive_TotalClusters, 0xFF876588)
+NHSTUB(GetDrive_FreeClusters, 0xFF8765C4)
+NHSTUB(GetFocusLensSubjectDistanceFromLens, 0xffa8ed00)
+NHSTUB(GetBatteryTemperature, 0xFF82E368)
+NHSTUB(GetCCDTemperature, 0xFF82E354)
+NHSTUB(GetOpticalTemperature, 0xFF82E340)
+NHSTUB(PT_PlaySound, 0xFF97BAA4)
+NHSTUB(EnterToCompensationEVF, 0xff967eb4)
+NHSTUB(ExitFromCompensationEVF, 0xff967f08)
Index: /trunk/platform/s2is/sub/100g/boot.c
===================================================================
--- /trunk/platform/s2is/sub/100g/boot.c	(revision 511)
+++ /trunk/platform/s2is/sub/100g/boot.c	(revision 511)
@@ -0,0 +1,238 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+const long new_sa = MEMISOSTART + MEMISOSIZE;
+
+/* Ours stuff */
+extern long wrs_kernel_bss_start;
+extern long wrs_kernel_bss_end;
+extern void createHook (void *pNewTcb);
+extern void deleteHook (void *pTcb);
+
+void boot();
+
+/* "relocated" functions */
+void __attribute__((naked,noinline)) h_usrInit();
+void __attribute__((naked,noinline)) h_usrKernelInit();
+void __attribute__((naked,noinline)) h_usrRoot();
+
+extern void mykbd_task_proceed_2();
+
+void __attribute__((naked,noinline)) h_kbd_p2_f()
+{
+    asm volatile (
+                 "LDR     R4, =0x103B0\n"
+                 "LDR     R1, [R4,#0x30]\n"
+                 "TST     R1, #0x8000\n"
+                 "BEQ     loc_FF829394\n"
+                 "MOV     R1, #0\n"
+                 "MOV     R0, #0xF\n"
+                 "MOV     R2, #0x8000\n"
+                 "BL      sub_FF829978\n"
+                 "LDR     R3, [R4,#0x30]\n"
+                 "BIC     R3, R3, #0x8000\n"
+                 "STR     R3, [R4,#0x30]\n"
+                 "MOV     R1, R3\n"
+    "loc_FF829394:\n"
+                 "TST     R1, #1\n"
+                 "BEQ     loc_FF8293BC\n"
+                 "MOV     R0, #0\n"
+                 "MOV     R1, R0\n"
+                 "MOV     R2, R5\n"
+                 "BL      sub_FF829978\n"
+                 "LDR     R3, [R4,#0x30]\n"
+                 "BIC     R3, R3, #1\n"
+                 "STR     R3, [R4,#0x30]\n"
+                 "MOV     R1, R3\n"
+    "loc_FF8293BC:\n"
+                 "TST     R1, #2\n"
+                 "BEQ     loc_FF8293E4\n"
+                 "MOV     R1, #0\n"
+                 "MOV     R0, R5\n"
+                 "MOV     R2, #2\n"
+                 "BL      sub_FF829978\n"
+                 "LDR     R3, [R4,#0x30]\n"
+                 "BIC     R3, R3, #2\n"
+                 "STR     R3, [R4,#0x30]\n"
+                 "MOV     R1, R3\n"
+    "loc_FF8293E4:\n"
+                 "LDR     R3, [R4,#0x34]\n"
+                 "LDR     R2, [R4,#0x38]\n"
+                 "ADD     R3, R1, R3\n"
+                 "CMN     R3, R2\n"
+                 "BEQ     loc_FF8293FC\n"
+                 "BL      sub_FF8299D8\n"
+    "loc_FF8293FC:\n"
+                 "LDR     R3, =0x1FC0\n"
+                 "LDR     R1, [R3]\n"
+                 "CMP     R1, #1\n"
+                 "BNE     loc_FF829418\n"
+                 "MOV     R0, #0x28\n"
+                 "MOV     R2, #0x100\n"
+                 "BL      sub_FF829978\n"
+    "loc_FF829418:\n"
+                 "LDR     R3, =0x103AC\n"
+                 "LDR     R0, [R3]\n"
+                 "CMP     R0, #1\n"
+                 "BNE     loc_FF829440\n"
+                 "MOV     R3, #0x30\n"
+                 "STRH    R3, [SP,#2]\n"
+                 "MOV     R1, R6\n"
+                 "LDR     R3, =0x10410\n"
+                 "MOV     LR, PC\n"
+                 "LDR     PC, [R3]\n"
+    "loc_FF829440:\n"
+                 "BL      sub_FF82A37C\n"
+                 "B       mykbd_task_proceed_2\n"
+    );
+}
+
+
+void boot()
+{
+    long *canon_data_src = (void*)0xFFB090B0;
+    long *canon_data_dst = (void*)0x1900;
+    long canon_data_len = 0xDBB0;
+    long *canon_bss_start = (void*)0xF4B0; // just after data
+    long canon_bss_len = 0x6EF70 - 0xF4B0;
+    long i;
+
+    asm volatile (
+	"MRC     p15, 0, R0,c1,c0\n"
+	"ORR     R0, R0, #0x1000\n"
+	"ORR     R0, R0, #4\n"
+	"ORR     R0, R0, #1\n"
+	"MCR     p15, 0, R0,c1,c0\n"
+    :::"r0");
+
+
+    for(i=0;i<canon_data_len/4;i++)
+	canon_data_dst[i]=canon_data_src[i];
+
+    for(i=0;i<canon_bss_len/4;i++)
+	canon_bss_start[i]=0;
+
+    asm volatile (
+	"MRC     p15, 0, R0,c1,c0\n"
+	"ORR     R0, R0, #0x1000\n"
+	"BIC     R0, R0, #4\n"
+	"ORR     R0, R0, #1\n"
+	"MCR     p15, 0, R0,c1,c0\n"
+    :::"r0");
+
+    h_usrInit();
+}
+
+
+void h_usrInit()
+{
+    asm volatile (
+	"STR     LR, [SP,#-4]!\n"
+	"BL      sub_FF811A40\n"
+	"MOV     R0, #2\n"
+	"MOV     R1, R0\n"
+	"BL      sub_FFAEF7EC\n"
+	"BL      sub_FFADBEC4\n"
+	"BL      sub_FF811298\n"
+	"BL      sub_FF811800\n"
+	"LDR     LR, [SP],#4\n"
+	"B	h_usrKernelInit\n"
+    );
+}
+
+void  h_usrKernelInit()
+{
+    asm volatile (
+	"STMFD   SP!, {R4,LR}\n"
+	"SUB     SP, SP, #8\n"
+	"BL      sub_FFAEFCEC\n"
+	"BL      sub_FFB024F8\n"
+	"LDR     R3, =0xE91C\n"
+	"LDR     R2, =0x6A2E0\n"
+	"LDR     R1, [R3]\n"
+	"LDR     R0, =0x6E930\n"
+	"MOV     R3, #0x100\n"
+	"BL      sub_FFAFDE28\n"
+	"LDR     R3, =0xE8DC\n"
+	"LDR     R0, =0xECFC\n"
+	"LDR     R1, [R3]\n"
+	"BL      sub_FFAFDE28\n"
+	"LDR     R3, =0xE998\n"
+	"LDR     R0, =0x6E904\n"
+	"LDR     R1, [R3]\n"
+	"BL      sub_FFAFDE28\n"
+	"BL      sub_FFB07078\n"
+	"BL      sub_FF811384\n"
+	"MOV     R4, #0\n"
+	"MOV     R3, R0\n"
+	"MOV     R12, #0x800\n"
+	"LDR     R0, =h_usrRoot\n"
+	"MOV     R1, #0x4000\n"
+    );    
+//	"LDR	 R2, =0x9EF70\n"	// 0x6EF70 + 0x30000
+    asm volatile (
+        "LDR     R2, =new_sa\n"
+        "LDR     R2, [R2]\n"
+    );
+    asm volatile (
+	"STR     R12, [SP]\n"
+	"STR     R4, [SP,#4]\n"
+	"BL      sub_FFAFF738\n"
+	"ADD     SP, SP, #8\n"
+	"LDMFD   SP!, {R4,PC}\n"
+    );
+}
+
+static long drv_struct[16];
+ 
+static long dh_err()
+{
+    return -1;
+}
+
+static void drv_self_hide()
+{
+    long drvnum;
+    
+    drvnum = _iosDrvInstall(dh_err,dh_err,dh_err,dh_err,dh_err,dh_err,dh_err);
+    if (drvnum >= 0)
+	_iosDevAdd(drv_struct, "A/DISKBOOT.BIN", drvnum);
+}
+
+
+void  h_usrRoot()
+{
+    asm volatile (
+	"STMFD   SP!, {R4,R5,LR}\n"
+	"MOV     R5, R0\n"
+	"MOV     R4, R1\n"
+	"BL      sub_FF811AA8\n"
+	"MOV     R1, R4\n"
+	"MOV     R0, R5\n"
+	"BL      sub_FFAF5E68\n"
+	"MOV     R1, R4\n"
+	"MOV     R0, R5\n"
+	"BL      sub_FFAF68E0\n"
+	"BL      sub_FF8118C0\n"
+	"BL      sub_FF8117DC\n"
+	"MOV     R0, #0x32\n"
+	"BL      sub_FFAF8884\n"
+	"BL      sub_FF811AEC\n"
+	"BL      sub_FF811ACC\n"
+	"BL      sub_FF811B18\n"
+	"BL      sub_FFAF8144\n"
+	"BL      sub_FF811A9C\n"
+    );
+
+    _taskCreateHookAdd(createHook);
+    _taskDeleteHookAdd(deleteHook);
+
+    drv_self_hide();
+
+    asm volatile (
+	"LDMFD   SP!, {R4,R5,LR}\n"
+	"B       sub_FF811444\n"
+    );
+}
+
Index: /trunk/platform/s2is/sub/100g/stubs_min.S
===================================================================
--- /trunk/platform/s2is/sub/100g/stubs_min.S	(revision 511)
+++ /trunk/platform/s2is/sub/100g/stubs_min.S	(revision 511)
@@ -0,0 +1,14 @@
+#include "stubs_asm.h"
+
+DEF(physw_status, 0x103E0)
+DEF(physw_run, 0x1FC0)
+DEF(playrec_mode, 0x56CC)
+DEF(kbd_const_1, 0x10484)
+DEF(led_table, 0x10610)
+DEF(zoom_busy, 0x64480)
+DEF(focus_busy, 0x645F4)
+DEF(FlashParamsTable,0xFF985604)
+DEF(canon_menu_active,0x7BD0)
+DEF(canon_shoot_menu_active,0x6CC1)
+DEF(recreview_hold, 0x60FD0)
+DEF(movie_status,0x5C95C)
Index: /trunk/platform/s2is/sub/100g/makefile.inc
===================================================================
--- /trunk/platform/s2is/sub/100g/makefile.inc	(revision 511)
+++ /trunk/platform/s2is/sub/100g/makefile.inc	(revision 511)
@@ -0,0 +1,15 @@
+#0x30F0
+PLATFORMID=12528
+
+PLATFORMOS=vxworks
+
+MEMBASEADDR=0x1900
+RESTARTSTART=0x50000
+MEMISOSTART=0x6EF70
+MEMISOSIZE=0x55000
+ROMBASEADDR=0xff810000
+
+TARGET_PRIMARY=$(topdir)platform/$(PLATFORM)/sub/$(PLATFORMSUB)/PRIMARY.BIN
+
+PLFLAGS=-DMEMBASEADDR=$(MEMBASEADDR) -DMEMISOSTART=$(MEMISOSTART) -DMEMISOSIZE=$(MEMISOSIZE)
+PLFLAGS+=-DRESTARTSTART=$(RESTARTSTART)
Index: /trunk/platform/s2is/sub/100g/stubs_asm.h
===================================================================
--- /trunk/platform/s2is/sub/100g/stubs_asm.h	(revision 511)
+++ /trunk/platform/s2is/sub/100g/stubs_asm.h	(revision 511)
@@ -0,0 +1,20 @@
+    .text
+
+#define DEF(n,a) \
+    .globl n; n = a
+
+#define NSTUB(name, addr)\
+    .globl _##name ;\
+    .weak _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define NHSTUB(name, addr)\
+    .globl _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define STUB(addr)\
+    .globl sub_ ## addr ;\
+    sub_ ## addr: ;\
+	ldr  pc, =0x ## addr
Index: /trunk/platform/s2is/sub/100g/lib.c
===================================================================
--- /trunk/platform/s2is/sub/100g/lib.c	(revision 511)
+++ /trunk/platform/s2is/sub/100g/lib.c	(revision 511)
@@ -0,0 +1,65 @@
+#include "platform.h"
+
+void *hook_raw_fptr()
+{
+    return (void*)0x2F4B0;
+}
+
+void *hook_raw_ret_addr()
+{
+    return (void*)0xFF8D8940;
+}
+
+char *hook_raw_image_addr()
+{
+    return (char*)(0x10595D54);
+}
+
+long hook_raw_size()
+{
+    return 0x644C40;
+}
+
+void *vid_get_viewport_live_fb()
+{
+    return (void*)0x0;
+}
+
+void *vid_get_bitmap_fb()
+{
+    return (void*)0x103CEB20;
+}
+
+void *vid_get_viewport_fb()
+{
+    return (void*)0x105F84F0; // 0x104B6C20;
+}
+
+void *vid_get_viewport_fb_d()
+{
+    return (void*)(*(int*)0x5BAF8);
+}
+
+long vid_get_bitmap_screen_width()
+{
+    return 360;
+}
+
+long vid_get_bitmap_screen_height()
+{
+    return 240;
+}
+
+long vid_get_viewport_height()
+{
+    return 240;
+}
+char *camera_jpeg_count_str()
+{
+    return (char*)0x63538;
+}
+
+long vid_get_bitmap_buffer_width() { return 360; }
+
+long vid_get_bitmap_buffer_height() { return 240; }
+
Index: /trunk/platform/s2is/sub/100g/movie_rec.c
===================================================================
--- /trunk/platform/s2is/sub/100g/movie_rec.c	(revision 511)
+++ /trunk/platform/s2is/sub/100g/movie_rec.c	(revision 511)
@@ -0,0 +1,660 @@
+#include "conf.h"
+
+int *video_quality = &conf.video_quality;
+int *video_mode    = &conf.video_mode;
+
+long def_table1[56]={
+0x10000,0xC000,0x5800, 0x2000, 0x1C6A, 0x1550,0x9C5,  0x38D,  0x3C45, 0x2D34, 0x14B8, 0x788,  0x5F60, 0x4788,
+0x20C9, 0xBE1, 0x8661, 0x64C9, 0x2E31, 0x10CB,0xB21A, 0x8594, 0x3D39, 0x1642, 0xE249, 0xA9B8, 0x4DC9, 0x1C48,
+0x117D2,0xD1DF,0x6030, 0x22F9, 0x153D5,0xFEE1,0x74D1, 0x2A79, 0x195F8,0x1307C,0x8B8D, 0x32AA, 0x1E01C,0x16817,
+0xA509, 0x3C01,0x2328E,0x1A5ED,0xC160, 0x4637,0x28C99,0x1E975,0xE054, 0x5190, 0x2F08B,0x2346B,0x102AF,0x5E0E
+};
+
+long def_table2[12]={0xE666,0xACCD,0x4F33,0x1CCD,-0x170A,-0x1148,-0x7EB,-0x2E1,-0x2BC6,-0x20D5,-0xF0C,-0x579};
+
+long table1[56], table2[12];
+
+void change_video_tables(int a, int b){
+ int i;
+ for (i=0;i<56;i++) table1[i]=(def_table1[i]*a)/b;
+ for (i=0;i<12;i++) table2[i]=(def_table2[i]*a)/b;
+}
+
+long CompressionRateTable[]={0x60, 0x5D, 0x5A, 0x57, 0x54, 0x51, 0x4D, 0x48, 0x42, 0x3B, 0x32, 0x29, 0x22, 0x1D, 0x17, 0x14, 0x10, 0xE, 0xB, 9, 7, 6, 5, 4, 3, 2, 1};
+
+
+void __attribute__((naked,noinline)) movie_record_task(){
+ asm volatile(
+                "STMFD   SP!, {R4,LR}\n"              
+                "SUB     SP, SP, #4\n"                
+                "MOV     R4, SP\n"                    
+                "B       loc_FF953CDC\n"              
+"loc_FF953C08:\n"                                      
+                "LDR     R3, =0x5C960\n"              
+                "LDR     R2, [R3]\n"                  
+                "CMP     R2, #0\n"                    
+                "BNE     loc_FF953CA4\n"              
+                "SUB     R3, R12, #1\n"               
+                "CMP     R3, #0xA\n"                  
+                "LDRLS   PC, [PC,R3,LSL#2]\n"         
+                "B       loc_FF953CA4\n"              
+                ".long loc_FF953C54\n"
+                ".long loc_FF953C5C\n"
+                ".long loc_FF953C74\n"
+                ".long loc_FF953C7C\n"
+                ".long loc_FF953C84\n"
+                ".long loc_FF953C64\n"
+                ".long loc_FF953C8C\n"
+                ".long loc_FF953C6C\n"
+                ".long loc_FF953CA4\n"
+                ".long loc_FF953C9C\n"
+                ".long loc_FF953C94\n"
+"loc_FF953C54:\n"                                      
+                                                  
+                "BL      sub_FF953D70\n"              
+                "B       loc_FF953CA0\n"              
+"loc_FF953C5C:\n"                                      
+                                                  
+                "BL      sub_FF953FC4\n"
+                "B       loc_FF953CA0\n"              
+"loc_FF953C64:\n"                                      
+                                                  
+                "BL      sub_FF954478_my\n"   //------------->           
+                "B       loc_FF953CA0\n"              
+"loc_FF953C6C:\n"                                      
+                                                  
+                "BL      sub_FF954910\n"              
+                "B       loc_FF953CA0\n"              
+"loc_FF953C74:\n"                                      
+                                                  
+                "BL      sub_FF9546E0\n"              
+                "B       loc_FF953CA0\n"              
+"loc_FF953C7C:\n"                                      
+                                                  
+                "BL      sub_FF954C28\n"              
+                "B       loc_FF953CA0\n"              
+"loc_FF953C84:\n"                                      
+                                                  
+                "BL      sub_FF954DEC\n"              
+                "B       loc_FF953CA0\n"              
+"loc_FF953C8C:\n"                                      
+                                                  
+                "BL      sub_FF954ADC\n"              
+                "B       loc_FF953CA0\n"              
+"loc_FF953C94:\n"                                      
+                                                  
+                "BL      sub_FF954BBC\n"              
+                "B       loc_FF953CA0\n"              
+"loc_FF953C9C:\n"                                      
+                                                  
+                "BL      sub_FF954730\n"              
+"loc_FF953CA0:\n"                                      
+                                                  
+                "LDR     R1, [SP]\n"                  
+"loc_FF953CA4:\n"                                      
+                                                  
+                "LDR     R3, [R1]\n"                  
+                "CMP     R3, #9\n"                    
+                "BNE     loc_FF953CBC\n"              
+                "MOV     R0, R1\n"                    
+                "BL      sub_FF954F7C\n"    
+                "LDR     R1, [SP]\n"                  
+"loc_FF953CBC:\n"                                      
+                "LDR     R3, =0x5C890\n"              
+                "MOV     R2, #0\n"                    
+                "LDR     R0, [R3]\n"                  
+                "STR     R2, [R1]\n"                  
+                "BL      sub_FF82134C\n"          
+                "LDR     R3, =0x5CA30\n"              
+                "LDR     R0, [R3]\n"                  
+                "BL      sub_FF821D54\n"             
+"loc_FF953CDC:\n"                                      
+                "LDR     R3, =0x5C88C\n"              
+                "MOV     R1, R4\n"                    
+                "LDR     R0, [R3]\n"                  
+                "MOV     R2, #0\n"                    
+                "BL      sub_FF820F34\n"       
+                "LDR     R3, =0x5CA30\n"              
+                "MOV     R1, #0\n"                    
+                "LDR     R0, [R3]\n"                  
+                "BL      sub_FF821B6C\n"             
+                "LDR     R0, [SP]\n"                  
+                "LDR     R12, [R0]\n"                 
+                "CMP     R12, #0xC\n"                 
+                "MOV     R1, R0\n"                    
+                "BNE     loc_FF953C08\n"              
+                "LDR     R3, =0x5C884\n"              
+                "LDR     R0, [R3]\n"                  
+                "BL      sub_FF821D54\n"             
+                "BL      sub_FF82275C\n"                  
+                "ADD     SP, SP, #4\n"                
+                "LDMFD   SP!, {R4,PC}\n"              
+ );
+}
+
+
+void __attribute__((naked,noinline)) sub_FF954478_my(){
+ asm volatile(
+                "STMFD   SP!, {R4-R8,LR}\n"           
+                "LDR     R5, =0x5C97C\n"              
+                "SUB     SP, SP, #0x1C\n"             
+                "LDR     R3, [R5]\n"                  
+                "CMP     R3, #3\n"                    
+                "MOV     R4, R0\n"                    
+                "MOVEQ   R3, #4\n"                    
+                "STREQ   R3, [R5]\n"                  
+                "LDR     R3, =0x5CA24\n"              
+                "MOV     LR, PC\n"                    
+                "LDR     PC, [R3]\n"                  
+                "LDR     R2, [R5]\n"                  
+                "CMP     R2, #4\n"                    
+                "BNE     loc_FF954610\n"              
+                "ADD     R0, SP, #0x18\n"             
+                "BL      sub_FF9567E4_my\n"   //------------------->          
+                "CMP     R0, #0\n"                    
+                "BNE     loc_FF9544E8\n"              
+                "LDR     R3, =0x5C968\n"              
+                "LDR     R2, [R3]\n"                  
+                "CMP     R2, #1\n"                    
+                "BNE     loc_FF954504\n"              
+                "LDR     R2, =0x5C9B8\n"              
+                "LDR     R1, =0x5C990\n"              
+                "LDR     R12, [R2]\n"                 
+                "LDR     R3, [R1]\n"                  
+                "CMP     R12, R3\n"                   
+                "BCC     loc_FF954504\n"              
+"loc_FF9544E8:\n"                                     
+                "BL      sub_FF954658\n"              
+                "LDR     R3, =0x5684\n"               
+                "LDR     R0, [R3]\n"                  
+                "BL      sub_FF8319D0\n"              
+                "MOV     R3, #5\n"                    
+                "STR     R3, [R5]\n"                  
+                "B       loc_FF954610\n"              
+"loc_FF954504:\n"                                     
+                                                  
+                "LDR     R0, [R4,#4]\n"               
+                "LDR     R5, [R4,#0xC]\n"             
+                "LDR     R3, =0x5C9C0\n"              
+                "LDR     R4, [R4,#8]\n"               
+                "LDR     R8, =0x5C9CC\n"              
+                "LDR     R6, =0x5C96C\n"              
+                "ADD     R12, SP, #0x14\n"            
+                "ADD     LR, SP, #0x10\n"             
+                "MOV     R7, #1\n"                    
+                "LDR     R2, [R3]\n"                  
+                "LDR     R1, [SP,#0x18]\n"            
+                "STMEA   SP, {R4,R5,R12,LR}\n"        
+                "LDR     R3, [R8]\n"                  
+                "STR     R7, [R6]\n"                  
+                "BL      sub_FF8A50F4\n"              
+                "LDR     R3, =0x5C884\n"              
+                "MOV     R1, #0x3E8\n"                
+                "LDR     R0, [R3]\n"                  
+                "BL      sub_FF821B6C\n"             
+                "CMP     R0, #9\n"                    
+                "BNE     loc_FF954568\n"              
+                "BL      sub_FF956F20\n"              
+                "LDR     R3, =0x5C97C\n"              
+                "LDR     R0, =0xFF954460\n"       
+                "B       loc_FF954580\n"              
+"loc_FF954568:\n"                                     
+                "LDR     R5, [SP,#0x10]\n"            
+                "CMP     R5, #0\n"                    
+                "BEQ     loc_FF95458C\n"              
+                "BL      sub_FF956F20\n"              
+                "LDR     R3, =0x5C97C\n"              
+                "LDR     R0, =0xFF95446C\n"       
+"loc_FF954580:\n"                                     
+                "STR     R7, [R3]\n"                  
+                "BL      sub_FF97C040\n"              
+                "B       loc_FF954610\n"              
+"loc_FF95458C:\n"                                     
+                "BL      sub_FF8A51A0\n"      
+                "LDR     R0, [SP,#0x18]\n"            
+                "LDR     R1, [SP,#0x14]\n"            
+                "BL      sub_FF956C38\n"              
+                "LDR     R4, =0x5C9B8\n"              
+                "LDR     R3, [R4]\n"                  
+                "ADD     R3, R3, #1\n"                
+                "LDR     R0, [SP,#0x14]\n"            
+                "MOV     R1, R8\n"                    
+                "STR     R3, [R4]\n"                  
+                "MOV     R2, R5\n"                    
+                "BL      sub_FF9556C8_my\n"  //---------------------->            
+                "LDR     R3, =0x5C9A4\n"              
+                "LDR     R4, [R4]\n"                  
+                "LDR     R1, [R3]\n"                  
+                "MOV     R0, R4\n"                    
+                "BL      sub_FFAEA020\n"                 
+                "CMP     R0, #0\n"                    
+                "BEQ     loc_FF9545EC\n"              
+                "LDR     R6, =0x5C970\n"              
+                "LDR     R3, [R6]\n"                  
+                "CMP     R3, #1\n"                    
+                "BNE     loc_FF954604\n"              
+                "B       loc_FF9545F0\n"              
+"loc_FF9545EC:\n"                                     
+                "LDR     R6, =0x5C970\n"              
+"loc_FF9545F0:\n"                                     
+                "MOV     R0, R4\n"                    
+                "LDR     R3, =0x5CA00\n"              
+                "MOV     LR, PC\n"                    
+                "LDR     PC, [R3]\n"                  
+                "STR     R5, [R6]\n"                  
+"loc_FF954604:\n"                                     
+                "LDR     R2, =0x5C96C\n"              
+                "MOV     R3, #0\n"                    
+                "STR     R3, [R2]\n"                  
+"loc_FF954610:\n"                                     
+                                                  
+                "ADD     SP, SP, #0x1C\n"             
+                "LDMFD   SP!, {R4-R8,PC}\n"           
+
+ );
+}
+
+
+void __attribute__((naked,noinline)) sub_FF9567E4_my(){
+ asm volatile(
+                "STMFD   SP!, {R4-R11,LR}\n"          
+                "LDR     R12, =0x5CD20\n"             
+                "LDR     R3, =0x5CD38\n"              
+                "SUB     SP, SP, #8\n"                
+                "LDR     R1, [R3]\n"                  
+                "LDR     R2, [R12]\n"                 
+                "LDR     R3, =0x5CDBC\n"              
+                "ADD     R7, R2, #1\n"                
+                "LDR     R3, [R3]\n"                  
+                "CMP     R7, R1\n"                    
+                "STR     R7, [R12]\n"                 
+                "MOV     R11, R0\n"                   
+                "STR     R3, [SP,#4]\n"               
+                "MOVHI   R3, #0\n"                    
+                "STRHI   R3, [R11]\n"                 
+                "MOVHI   R0, #0x80000001\n"           
+                "BHI     loc_FF956BE8\n"              
+                "LDR     R3, =0x5CDA0\n"              
+                "LDR     R4, [R3]\n"                  
+                "MOV     R0, R7\n"                    
+                "MOV     R1, R4\n"                    
+                "BL      sub_FFAEA020\n"                 
+                "CMP     R0, #1\n"                    
+                "BNE     loc_FF956A7C\n"              
+                "LDR     R3, =0x5CDC0\n"              
+                "LDR     R1, =0x5CDCC\n"              
+                "LDR     R0, =0x5CD08\n"              
+                "LDR     R10, [R3]\n"                 
+                "LDR     R2, [R1]\n"                  
+                "LDR     R5, [R0]\n"                  
+                "ADD     R2, R10, R2\n"               
+                "CMP     R2, R5\n"                    
+                "BNE     loc_FF956898\n"              
+                "MOV     R1, R4\n"                    
+                "MOV     R0, R7\n"                    
+                "BL      sub_FFAE9990\n"                 
+                "LDR     R2, =0xAAAAAAAB\n"           
+                "ADD     R0, R0, #1\n"                
+                "UMULL   R1, R3, R2, R0\n"            
+                "MOV     R3, R3,LSR#1\n"              
+                "ADD     R3, R3, R3,LSL#1\n"          
+                "LDR     R4, =0x5CD10\n"              
+                "RSB     R0, R3, R0\n"                
+                "STR     R10, [R4,R0,LSL#2]\n"        
+                "B       loc_FF9568C4\n"              
+"loc_FF956898:\n"                                     
+                "MOV     R1, R4\n"                    
+                "MOV     R0, R7\n"                    
+                "BL      sub_FFAE9990\n"                 
+                "LDR     R2, =0xAAAAAAAB\n"           
+                "ADD     R0, R0, #1\n"                
+                "UMULL   R1, R3, R2, R0\n"            
+                "MOV     R3, R3,LSR#1\n"              
+                "ADD     R3, R3, R3,LSL#1\n"          
+                "LDR     R4, =0x5CD10\n"              
+                "RSB     R0, R3, R0\n"                
+                "STR     R5, [R4,R0,LSL#2]\n"         
+"loc_FF9568C4:\n"                                     
+                "LDR     R3, =0x5CD20\n"              
+                "LDR     R2, =0x5CDA0\n"              
+                "LDR     R0, [R3]\n"                  
+                "LDR     R1, [R2]\n"                  
+                "BL      sub_FFAE9990\n"                 
+                "LDR     R2, =0xAAAAAAAB\n"           
+                "ADD     R0, R0, #1\n"                
+                "UMULL   R1, R3, R2, R0\n"            
+                "MOV     R3, R3,LSR#1\n"              
+                "ADD     R3, R3, R3,LSL#1\n"          
+                "RSB     R0, R3, R0\n"                
+                "LDR     R3, =0x5CD04\n"              
+                "LDR     R12, [R4,R0,LSL#2]\n"        
+                "LDR     R2, [R3]\n"                  
+                "CMP     R12, R2\n"                   
+                "BHI     loc_FF956920\n"              
+                "LDR     R4, =0x5CD58\n"              
+                "LDR     R3, [R4]\n"                  
+                "ADD     R3, R12, R3\n"               
+                "ADD     R3, R3, #8\n"                
+                "CMP     R2, R3\n"                    
+                "BCS     loc_FF956924\n"              
+                "B       loc_FF956AF8\n"              
+"loc_FF956920:\n"                                     
+                "LDR     R4, =0x5CD58\n"              
+"loc_FF956924:\n"                                     
+                "LDR     R2, =0x5CDC0\n"              
+                "LDR     R1, =0x5CDCC\n"              
+                "LDR     R0, [R4]\n"                  
+                "LDR     R3, [R1]\n"                  
+                "LDR     LR, [R2]\n"                  
+                "ADD     R0, R12, R0\n"               
+                "ADD     R2, LR, R3\n"                
+                "ADD     R1, R0, #8\n"                
+                "CMP     R1, R2\n"                    
+                "BLS     loc_FF956974\n"              
+                "LDR     R3, =0x5CD04\n"              
+                "RSB     R2, R2, R0\n"                
+                "ADD     R0, R2, #8\n"                
+                "LDR     R1, [R3]\n"                  
+                "ADD     R2, LR, R0\n"                
+                "CMP     R1, R2\n"                    
+                "BCC     loc_FF956AF8\n"              
+                "LDR     R3, =0x5CD08\n"              
+                "STR     R2, [R3]\n"                  
+                "B       loc_FF95697C\n"              
+"loc_FF956974:\n"                                     
+                "LDR     R3, =0x5CD08\n"              
+                "STR     R1, [R3]\n"                  
+"loc_FF95697C:\n"                                     
+                "LDR     R3, [R4]\n"                  
+                "LDR     R12, =0x5CD70\n"             
+                "ADD     R3, R3, #0x18\n"             
+                "LDR     R2, [R12,#4]\n"              
+                "MOV     R0, R3\n"                    
+                "MOV     R1, #0\n"                    
+                "CMP     R1, R2\n"                    
+                "BHI     loc_FF956B38\n"              
+                "BNE     loc_FF9569AC\n"              
+                "LDR     R3, [R12]\n"                 
+                "CMP     R0, R3\n"                    
+                "BHI     loc_FF956B38\n"              
+"loc_FF9569AC:\n"                                     
+                "LDR     R4, [R4]\n"                  
+                "LDR     LR, =0x5CD78\n"              
+                "STR     R4, [SP]\n"                  
+                "LDR     R12, =0x5CD70\n"             
+                "LDR     R3, =0x5CD20\n"              
+                "LDMIA   LR, {R7,R8}\n"               
+                "LDMIA   R12, {R5,R6}\n"              
+                "LDR     R10, [R3]\n"                 
+                "LDR     R2, =0x5CDA0\n"              
+                "MOV     R3, R4\n"                    
+                "MOV     R4, #0\n"                    
+                "ADDS    R7, R7, R3\n"                
+                "ADC     R8, R8, R4\n"                
+                "LDR     R9, [R2]\n"                  
+                "SUBS    R5, R5, R3\n"                
+                "SBC     R6, R6, R4\n"                
+                "MVN     R2, #0\n"                    
+                "MVN     R1, #0x17\n"                 
+                "ADDS    R5, R5, R1\n"                
+                "MOV     R4, #0\n"                    
+                "MOV     R3, #0x18\n"                 
+                "ADC     R6, R6, R2\n"                
+                "ADDS    R7, R7, R3\n"                
+                "ADC     R8, R8, R4\n"                
+                "STMIA   R12, {R5,R6}\n"              
+                "SUB     R0, R10, #1\n"               
+                "MOV     R1, R9\n"                    
+                "STMIA   LR, {R7,R8}\n"               
+                "BL      sub_FFAE9990\n"                 
+                "CMP     R10, #1\n"                   
+                "MLA     R0, R9, R0, R0\n"            
+                "BEQ     loc_FF956A7C\n"              
+                "LDR     R1, [SP,#4]\n"               
+                "SUB     R3, R0, #1\n"                
+                "MOV     R3, R3,LSL#4\n"              
+                "ADD     R4, R1, #0x10\n"             
+                "ADD     R5, R1, #0x14\n"             
+                "LDR     R1, [R5,R3]\n"               
+                "LDR     R2, [R4,R3]\n"               
+                "MOV     R3, R0,LSL#4\n"              
+                "LDR     R0, [SP,#4]\n"               
+                "ADD     R2, R2, R1\n"                
+                "LDR     LR, =0x62773130\n"           
+                "ADD     R1, R0, #8\n"                
+                "ADD     R12, R0, #0xC\n"             
+                "ADD     R2, R2, #8\n"                
+                "MOV     R0, #0\n"                    
+                "STR     LR, [R1,R3]\n"               
+                "STR     R0, [R12,R3]\n"              
+                "STR     R2, [R4,R3]\n"               
+                "LDR     R1, [SP]\n"                  
+                "STR     R1, [R5,R3]\n"               
+"loc_FF956A7C:\n"                                     
+                                                  
+                "LDR     R2, =0x5CD08\n"              
+                "LDR     R3, [R2]\n"                  
+                "ADD     R1, R3, #8\n"                
+                "STR     R1, [R11]\n"                 
+                "LDR     R0, =0x5CD04\n"              
+                "LDR     R2, [R0]\n"                  
+                "CMP     R3, R2\n"                    
+                "BHI     loc_FF956AB4\n"              
+                "LDR     LR, =0x5CD68\n"              
+                "LDR     R3, [LR]\n"                  
+                "ADD     R3, R1, R3\n"                
+                "CMP     R2, R3\n"                    
+                "BCS     loc_FF956AB8\n"              
+                "B       loc_FF956AF8\n"              
+"loc_FF956AB4:\n"                                     
+                "LDR     LR, =0x5CD68\n"              
+"loc_FF956AB8:\n"                                     
+                "LDR     R3, =0x5CDC0\n"              
+                "LDR     R2, =0x5CDCC\n"              
+                "LDR     R12, [R3]\n"                 
+                "LDR     R0, [R2]\n"                  
+                "LDR     R1, [R11]\n"                 
+                "LDR     R3, [LR]\n"                  
+                "ADD     R2, R1, R3\n"                
+                "ADD     R1, R12, R0\n"               
+                "CMP     R2, R1\n"                    
+                "BLS     loc_FF956B08\n"              
+                "RSB     R0, R1, R2\n"                
+                "LDR     R1, =0x5CD04\n"              
+                "LDR     R2, [R1]\n"                  
+                "ADD     R3, R12, R0\n"               
+                "CMP     R2, R3\n"                    
+                "BCS     loc_FF956B08\n"              
+"loc_FF956AF8:\n"                                     
+                                                  
+                "MOV     R3, #0\n"                    
+                "STR     R3, [R11]\n"                 
+                "MOV     R0, #0x80000003\n"           
+                "B       loc_FF956BE8\n"              
+"loc_FF956B08:\n"                                     
+                                                  
+                "LDR     R3, [LR]\n"                  
+                "LDR     R12, =0x5CD70\n"             
+                "ADD     R3, R3, #0x18\n"             
+                "LDR     R2, [R12,#4]\n"              
+                "MOV     R0, R3\n"                    
+                "MOV     R1, #0\n"                    
+                "CMP     R1, R2\n"                    
+                "BHI     loc_FF956B38\n"              
+                "BNE     loc_FF956B48\n"              
+                "LDR     R3, [R12]\n"                 
+                "CMP     R0, R3\n"                    
+                "BLS     loc_FF956B48\n"              
+"loc_FF956B38:\n"                                     
+                                                  
+                "MOV     R3, #0\n"                    
+                "STR     R3, [R11]\n"                 
+                "MOV     R0, #0x80000005\n"           
+                "B       loc_FF956BE8\n"              
+"loc_FF956B48:\n"                                     
+                                                  
+                "LDR     R1, =0x5CD50\n"              
+                "LDR     R0, =0x5CDA0\n"              
+                "LDR     R3, [R1]\n"                  
+                "LDR     R2, [R0]\n"                  
+                "ADD     R3, R3, R2,LSL#4\n"          
+                "ADD     R3, R3, R3,LSL#2\n"          
+                "LDR     R12, =0x5CD70\n"             
+                "MOV     R3, R3,LSL#1\n"              
+                "ADD     R3, R3, #0xA0\n"             
+                "LDR     R2, [R12,#4]\n"              
+                "MOV     R0, R3\n"                    
+                "MOV     R1, #0\n"                    
+                "CMP     R1, R2\n"                    
+                "BHI     loc_FF956B90\n"              
+                "BNE     loc_FF956BB4\n"              
+                "LDR     R3, [R12]\n"                 
+                "CMP     R0, R3\n"                    
+                "BLS     loc_FF956BB4\n"              
+"loc_FF956B90:\n"                                     
+                "LDR     R4, =0x5CD88\n"              
+                "LDR     R1, [R4]\n"                  
+                "CMP     R1, #0\n"                    
+                "BNE     loc_FF956BB4\n"              
+                "MOV     R0, #0x3140\n"               
+                "ADD     R0, R0, #8\n"                
+                "BL      sub_FF97FF70\n"              
+                "MOV     R3, #1\n"                    
+                "STR     R3, [R4]\n"                  
+"loc_FF956BB4:\n"                                     
+                                                  
+                "LDR     R2, =0x5CD78\n"              
+                "LDR     R3, [R2,#4]\n"               
+                "CMP     R3, #0\n"                    
+                "BHI     loc_FF956BD4\n"              
+                "BNE     loc_FF956BE4\n"              
+                "LDR     R3, [R2]\n"                  
+                "CMP     R3, #0x40000000\n"           
+
+          //    "BLS     loc_FF956BE4\n"     // -           
+
+                "B       loc_FF956BE4\n"     // +
+
+"loc_FF956BD4:\n"                                     
+                "MOV     R3, #0\n"                    
+                "STR     R3, [R11]\n"                 
+                "MOV     R0, #0x80000007\n"           
+                "B       loc_FF956BE8\n"              
+"loc_FF956BE4:\n"                                     
+                                                  
+                "MOV     R0, #0\n"                    
+"loc_FF956BE8:\n"                                     
+                                                  
+                "ADD     SP, SP, #8\n"                
+                "LDMFD   SP!, {R4-R11,PC}\n"          
+
+ );
+}
+
+
+void __attribute__((naked,noinline)) sub_FF9556C8_my(){
+ asm volatile(
+                "CMP     R2, #1\n"                    
+                "STMFD   SP!, {R4-R7,LR}\n"           
+                "MOV     R7, R0\n"                    
+                "MOV     R6, R1\n"                    
+                "LDREQ   R3, =CompressionRateTable\n" 
+                "LDREQ   R2, [R3]\n"                  
+                "STREQ   R2, [R6]\n"                  
+                "LDMEQFD SP!, {R4-R7,PC}\n"           
+                "LDR     R12, =0x5CA80\n"             
+                "LDR     R0, [R12]\n"                 
+                "LDR     R3, =0x5CA88\n"              
+                "CMP     R0, #0\n"                    
+                "LDR     R1, [R3]\n"                  
+                "BEQ     loc_FF955714\n"              
+                "LDR     R2, =0x5CA8C\n"              
+                "LDR     R3, [R2]\n"                  
+                "CMP     R3, #1\n"                    
+                "BNE     loc_FF955728\n"              
+                "B       loc_FF955718\n"              
+"loc_FF955714:\n"                                     
+                "LDR     R2, =0x5CA8C\n"              
+"loc_FF955718:\n"                                     
+                "MOV     R3, #0\n"                    
+                "STR     R3, [R2]\n"                  
+                "STR     R7, [R12]\n"                 
+                "B       loc_FF9557DC\n"              
+"loc_FF955728:\n"                                     
+                "LDR     R3, =0x5CA84\n"              
+                "LDR     R2, [R3]\n"                  
+                "LDR     R5, =table1\n"  // + 0xFF95549C       
+                "MOV     LR, R2,LSL#2\n"              
+                "LDR     R3, [R5,LR]\n"               
+                "LDR     R4, =table2\n"  // + 0xFF95557C       
+                "RSB     R12, R3, R0\n"               
+                "LDR     R2, [R4,LR]\n"               
+                "CMP     R12, #0\n"                   
+                "RSB     R0, R2, R0\n"                
+                "BLE     loc_FF955788\n"              
+                "ADD     R3, R5, #0x10\n"             
+                "LDR     R2, [R3,LR]\n"               
+                "CMP     R2, R12\n"                   
+                "ADDGE   R1, R1, #1\n"                
+                "BGE     loc_FF95577C\n"              
+                "ADD     R3, R5, #0x20\n"             
+                "LDR     R2, [R3,LR]\n"               
+                "CMP     R2, R12\n"                   
+                "ADDGE   R1, R1, #2\n"                
+                "ADDLT   R1, R1, #3\n"                
+"loc_FF95577C:\n"                                     
+           //   "CMP     R1, #0xE\n"    // -           
+           //   "MOVGE   R1, #0xE\n"    // -           
+                "CMP     R1, #0x1A\n"   // +            
+                "MOVGE   R1, #0x1A\n"   // +            
+
+                "B       loc_FF9557C0\n"              
+"loc_FF955788:\n"                                     
+                "CMP     R0, #0\n"                    
+                "BGE     loc_FF9557C0\n"              
+                "ADD     R3, R4, #0x10\n"             
+                "LDR     R2, [R3,LR]\n"               
+                "CMP     R2, R0\n"                    
+                "SUBLE   R1, R1, #1\n"                
+                "BLE     loc_FF9557B8\n"              
+                "ADD     R3, R4, #0x20\n"             
+                "LDR     R2, [R3,LR]\n"               
+                "CMP     R2, R0\n"                    
+                "SUBLE   R1, R1, #2\n"                
+                "SUBGT   R1, R1, #3\n"                
+"loc_FF9557B8:\n"                                     
+                "CMP     R1, #0\n"                    
+                "MOVLT   R1, #0\n"                    
+"loc_FF9557C0:\n"                                     
+                                                  
+                "LDR     R0, =0x5CA88\n"              
+                "LDR     R3, [R0]\n"                  
+                "CMP     R1, R3\n"                    
+                "LDRNE   R2, =0x5CA8C\n"              
+                "MOVNE   R3, #1\n"                    
+                "STRNE   R1, [R0]\n"                  
+                "STRNE   R3, [R2]\n"                  
+"loc_FF9557DC:\n"                                     
+                "LDR     R3, =0x5CA88\n"              
+           //   "LDR     R1, =0x5688\n"   // -
+                "LDR     R1, =video_mode\n" //+     
+                "LDR     R0, [R3]\n"                  
+                "LDR     R2, =CompressionRateTable\n" 
+                "LDR     R12, [R1]\n"
+                "LDR     R12, [R12]\n" //+                
+                "LDR     LR, [R2,R0,LSL#2]\n"         
+                "LDR     R3, =0x5CA80\n"              
+                "CMP     R12, #1\n"                   
+                "STR     R7, [R3]\n"                  
+                "STR     LR, [R6]\n"                  
+           //   "MOVEQ   R3, #0xB\n"        // -
+
+                "LDREQ   R3, =video_quality\n"          // +
+                "LDREQ   R3, [R3]\n"                    // +
+                "LDREQ   R3, [R3]\n"                    // +
+
+                "STREQ   R3, [R6]\n"                  
+                "LDMFD   SP!, {R4-R7,PC}\n"           
+
+ );
+}
Index: /trunk/platform/s2is/sub/100g/stubs_auto.S
===================================================================
--- /trunk/platform/s2is/sub/100g/stubs_auto.S	(revision 511)
+++ /trunk/platform/s2is/sub/100g/stubs_auto.S	(revision 511)
@@ -0,0 +1,96 @@
+/* THIS FILE IS GENERATED */
+/* DO NOT EDIT THIS FILE! */
+
+#include "stubs_asm.h"
+
+STUB(FF811298)
+STUB(FF811384)
+STUB(FF811444)
+STUB(FF8117DC)
+STUB(FF811800)
+STUB(FF8118C0)
+STUB(FF811A40)
+STUB(FF811A9C)
+STUB(FF811AA8)
+STUB(FF811ACC)
+STUB(FF811AEC)
+STUB(FF811B18)
+STUB(FF813D58)
+STUB(FF82072C)
+STUB(FF8208C8)
+STUB(FF820F34)
+STUB(FF82134C)
+STUB(FF821B6C)
+STUB(FF821D54)
+STUB(FF82275C)
+STUB(FF825F00)
+STUB(FF829978)
+STUB(FF8299D8)
+STUB(FF82A37C)
+STUB(FF8319D0)
+STUB(FF8A50F4)
+STUB(FF8A51A0)
+STUB(FF9538FC)
+STUB(FF953938)
+STUB(FF953D70)
+STUB(FF953FC4)
+STUB(FF954478)
+STUB(FF954658)
+STUB(FF9546E0)
+STUB(FF954730)
+STUB(FF954910)
+STUB(FF954ADC)
+STUB(FF954BBC)
+STUB(FF954C28)
+STUB(FF954DEC)
+STUB(FF954F7C)
+STUB(FF9556C8)
+STUB(FF9567E4)
+STUB(FF956C38)
+STUB(FF956F20)
+STUB(FF969E20)
+STUB(FF96A6F0)
+STUB(FF96AB80)
+STUB(FF96BAF0)
+STUB(FF96BDC0)
+STUB(FF96BFA4)
+STUB(FF96CFB0)
+STUB(FF96D734)
+STUB(FF96D7E4)
+STUB(FF96D8DC)
+STUB(FF96DA54)
+STUB(FF96DD44)
+STUB(FF96DDE0)
+STUB(FF96E3A8)
+STUB(FF96E43C)
+STUB(FF96E580)
+STUB(FF96E878)
+STUB(FF96E95C)
+STUB(FF96EA14)
+STUB(FF96ED20)
+STUB(FF96ED98)
+STUB(FF96EDE4)
+STUB(FF96EE4C)
+STUB(FF96F2A4)
+STUB(FF96F334)
+STUB(FF96F37C)
+STUB(FF96F5F8)
+STUB(FF96FC78)
+STUB(FF97ABAC)
+STUB(FF97ABB8)
+STUB(FF97C040)
+STUB(FF97FF70)
+STUB(FFADBEC4)
+STUB(FFAE9990)
+STUB(FFAEA020)
+STUB(FFAEF7EC)
+STUB(FFAEFCEC)
+STUB(FFAF1F48)
+STUB(FFAF5E68)
+STUB(FFAF68E0)
+STUB(FFAF8144)
+STUB(FFAF8884)
+STUB(FFAFDE28)
+STUB(FFAFF738)
+STUB(FFB024F8)
+STUB(FFB07078)
Index: /trunk/platform/s2is/sub/100g/Makefile
===================================================================
--- /trunk/platform/s2is/sub/100g/Makefile	(revision 511)
+++ /trunk/platform/s2is/sub/100g/Makefile	(revision 511)
@@ -0,0 +1,6 @@
+topdir=../../../../
+
+OBJS=boot.o stubs_min.o stubs_auto.o stubs_entry.o lib.o stubs_entry_2.o capt_seq.o movie_rec.o
+STUBS_AUTO_DEPS=boot.c capt_seq.c movie_rec.c
+
+include $(topdir)/platform/makefile_sub.inc
Index: /trunk/platform/s2is/sub/Makefile
===================================================================
--- /trunk/platform/s2is/sub/Makefile	(revision 511)
+++ /trunk/platform/s2is/sub/Makefile	(revision 511)
@@ -0,0 +1,8 @@
+topdir=../../../
+include $(topdir)makefile.inc
+
+SUBDIRS=$(PLATFORMSUB)
+
+all: all-recursive
+
+clean: clean-recursive
Index: /trunk/platform/s2is/shooting.c
===================================================================
--- /trunk/platform/s2is/shooting.c	(revision 511)
+++ /trunk/platform/s2is/shooting.c	(revision 511)
@@ -0,0 +1,99 @@
+#define PARAM_FILE_COUNTER      0x29
+
+#include "platform.h"
+
+const ApertureSize aperture_sizes_table[] = {
+    {  9, 283, "2.7" },
+    { 10, 320, "3.2" },
+    { 11, 352, "3.5" },
+    { 12, 384, "4.0" },
+    { 13, 416, "4.5" },
+    { 14, 448, "5.0" },
+    { 15, 480, "5.6" },
+    { 16, 512, "6.3" },
+    { 17, 544, "7.1" },
+    { 18, 576, "8.0" },
+};
+
+const ShutterSpeed shutter_speeds_table[] = {
+    { -12, -384, "15", 15000000 },
+    { -11, -352, "13", 13000000 },
+    { -10, -320, "10", 10000000 },
+    {  -9, -288, "8",   8000000 },
+    {  -8, -256, "6",   6000000 },
+    {  -7, -224, "5",   5000000 },
+    {  -6, -192, "4",   4000000 },
+    {  -5, -160, "3.2", 3200000 },
+    {  -4, -128, "2.5", 2500000 },
+    {  -3,  -96, "2",   2000000 },
+    {  -2,  -64, "1.6", 1600000 },
+    {  -1,  -32, "1.3", 1300000 },
+    {   0,    0, "1",   1000000 },
+    {   1,   32, "0.8",  800000 },
+    {   2,   64, "0.6",  600000 },
+    {   3,   96, "0.5",  500000 },
+    {   4,  128, "0.4",  400000 },
+    {   5,  160, "0.3",  300000 },
+    {   6,  192, "1/4",  250000 },
+    {   7,  224, "1/5",  200000 },
+    {   8,  256, "1/6",  166667 },
+    {   9,  288, "1/8",  125000 },
+    {  10,  320, "1/10", 100000 },
+    {  11,  352, "1/13",  76923 },
+    {  12,  384, "1/15",  66667 },
+    {  13,  416, "1/20",  50000 },
+    {  14,  448, "1/25",  40000 },
+    {  15,  480, "1/30",  33333 },
+    {  16,  512, "1/40",  25000 },
+    {  17,  544, "1/50",  20000 },
+    {  18,  576, "1/60",  16667 },
+    {  19,  608, "1/80",  12500 },
+    {  20,  640, "1/100", 10000 },
+    {  21,  672, "1/125",  8000 },
+    {  22,  704, "1/160",  6250 },
+    {  23,  736, "1/200",  5000 },
+    {  24,  768, "1/250",  4000 },
+    {  25,  800, "1/320",  3125 },
+    {  26,  832, "1/400",  2500 },
+    {  27,  864, "1/500",  2000 },
+    {  28,  896, "1/640",  1563 },
+    {  29,  928, "1/800",  1250 },
+    {  30,  960, "1/1000", 1000 },
+    {  31,  992, "1/1250",  800 },
+    {  32, 1021, "1/1600",  625 },
+    {  33, 1053, "1/2000",  500 },
+    {  34, 1084, "1/2500",  400 },
+    {  35, 1117, "1/3200",  313 },
+};
+
+const ISOTable iso_table[] = {
+    {  0,    0, "Auto", -1},
+    {  1,   50,   "50", -1},
+    {  2,  100,  "100", -1},
+    {  3,  200,  "200", -1},
+    {  4,  400,  "400", -1},
+};          
+
+#include "../generic/shooting.c"
+
+long get_file_next_counter() {
+    return ((get_file_counter()>>4)+1)<<4;
+}
+
+long get_target_file_num() {
+    long n;
+    
+    n = get_file_next_counter();
+    n = (n>>4)&0x3FFF;
+    return n;
+}
+
+long get_target_dir_num() {
+    long n;
+    
+    n = get_file_next_counter();
+    n = (n>>18)&0x3FF;
+    return n;
+}
+
+int circle_of_confusion = 5;
Index: /trunk/platform/s2is/Makefile
===================================================================
--- /trunk/platform/s2is/Makefile	(revision 511)
+++ /trunk/platform/s2is/Makefile	(revision 511)
@@ -0,0 +1,26 @@
+curdir=./
+topdir=../../
+
+include $(topdir)makefile.inc
+
+CFLAGS+=-DLOW_LEVEL
+
+SUBDIRS=sub
+
+all: all-recursive libplatform.a
+
+OBJS=main.o lib.o wrappers.o kbd.o shooting.o
+# stubs_init.o
+
+kbd.o: kbd.c ../generic/kbd.c
+lib.o: lib.c ../generic/lib.c
+main.o: main.c ../generic/main.c
+shooting.o: shooting.c ../generic/shooting.c
+wrappers.o: wrappers.c ../generic/wrappers.c
+
+libplatform.a: $(OBJS)
+
+clean: clean-recursive
+	rm -f $(OBJS) libplatform.a
+
+include $(topdir)bottom.inc
Index: /trunk/platform/s3is/kbd.c
===================================================================
--- /trunk/platform/s3is/kbd.c	(revision 511)
+++ /trunk/platform/s3is/kbd.c	(revision 511)
@@ -0,0 +1,465 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+#include "conf.h"
+#include "keyboard.h"
+
+typedef struct {
+	short grp;
+	short hackkey;
+	long canonkey;
+} KeyMap;
+
+
+static long kbd_new_state[3];
+static long kbd_prev_state[3];
+static long kbd_mod_state[3];
+static KeyMap keymap[];
+static long last_kbd_key = 0;
+static long alt_mode_key_mask = 0x00004000;
+static int usb_power;
+static int remote_key, remote_count;
+static int shoot_counter=0;
+#define DELAY_TIMEOUT 10000
+
+#define KEYS_MASK0 (0x00000003)
+#define KEYS_MASK1 (0x5f7f7038)
+#define KEYS_MASK2 (0x00000000)
+
+#define NEW_SS (0x2000)
+#define SD_READONLY_FLAG (0x20000)
+#define USB_MASK (8)
+#define USB_REG 2
+
+#ifndef MALLOCD_STACK
+static char kbd_stack[NEW_SS];
+#endif
+
+extern void _platformsub_kbd_fetch_data(long*);
+long __attribute__((naked)) wrap_kbd_p1_f() ;
+
+void wait_until_remote_button_is_released(void)
+{
+
+long x[3];
+int count1;
+int count2;
+int tick,tick2,tick3;
+int nSW;
+int prev_usb_power,cur_usb_power;
+
+ // ------ add by Masuji SUTO (start) --------------
+    static int nMode;
+ // ------ add by Masuji SUTO (end)   --------------
+
+asm volatile ("STMFD SP!, {R0-R11,LR}\n"); // store R0-R11 and LR in stack
+/*
+debug_led(1);
+tick = get_tick_count();
+tick2 = tick;
+
+if (conf.synch_enable && conf.ricoh_ca1_mode && conf.remote_enable && (!shooting_get_drive_mode()|| ((shooting_get_drive_mode()==2) && state_shooting_progress != SHOOTING_PROGRESS_PROCESSING)))  // synch mode enable so wait for USB to disconnect
+  {
+// ------ add by Masuji SUTO (start) --------------
+        nMode=0;
+           _platformsub_kbd_fetch_data(x);
+     _kbd_read_keys_r2(x);
+        if((x[USB_REG]&USB_MASK)==USB_MASK) nMode=1;
+// ------ add by Masuji SUTO (end)   --------------
+if(conf.ricoh_ca1_mode && conf.remote_enable)			//ricoh_ca1_mode
+{
+	if(shooting_get_drive_mode()==1 && state_shooting_progress == SHOOTING_PROGRESS_PROCESSING){			//continuous-shooting mode
+		if(conf.bracket_type>2){
+			if(shoot_counter<2) shutter_int=3;
+			shoot_counter--;
+			}
+		else{
+			prev_usb_power=0;
+			nSW = 0;
+			do
+				{     
+_platformsub_kbd_fetch_data(x);
+_kbd_read_keys_r2(x);
+				cur_usb_power = (x[USB_REG]&USB_MASK)==USB_MASK;
+				if(cur_usb_power){
+					if(!prev_usb_power){
+						tick2 = get_tick_count();
+						prev_usb_power=cur_usb_power;
+						}
+					else{
+						if((int)get_tick_count()-tick2>1000) {debug_led(0);}
+						}
+					}
+				else{
+					if(prev_usb_power){
+						tick3 = (int)get_tick_count()-tick2;
+						if(nSW==10) {
+							if(tick3>50) shutter_int=1;
+							nSW=20;
+							}
+						if(nSW==0 && tick3>0) {
+							if(tick3<50) {
+							nSW=10;
+							}
+						else{
+							if(tick3>1000) shutter_int=1;
+								nSW=20;
+							}
+						}
+						prev_usb_power=cur_usb_power;
+						}
+					}
+				if((int)get_tick_count()-tick >= DELAY_TIMEOUT) {nSW=20;shutter_int=2;}
+				}
+			 while(nSW<20);
+			 }
+		} 		//continuous-shooting mode 
+		else{		//nomal mode 
+			shoot_counter=0;
+			if(conf.bracket_type>2){
+				shoot_counter=(conf.bracket_type-2)*2;
+				}
+		   do
+		         {     
+           _platformsub_kbd_fetch_data(x);
+     _kbd_read_keys_r2(x);
+		           }
+		//   while(((x[USB_REG]&USB_MASK)==USB_MASK) && ((int)get_tick_count()-tick < DELAY_TIMEOUT));
+		// ------ modif by Masuji SUTO (start) --------------
+		        while(((((x[USB_REG]&USB_MASK)!=USB_MASK) && (nMode==0)) || (((x[USB_REG]&USB_MASK)==USB_MASK) && (nMode==1))) && ((int)get_tick_count()-tick < DELAY_TIMEOUT));
+		// ------ modif by Masuji SUTO (end)   --------------
+		} 		//nomal mode 
+	}		//ricoh_ca1_mode
+else		//ricoh_ca1_mode disebale
+   {
+
+   do
+         {
+           _platformsub_kbd_fetch_data(x);
+     _kbd_read_keys_r2(x);
+             
+           }
+
+  while(((x[USB_REG]&USB_MASK)==USB_MASK)&&  ((int)get_tick_count()-tick < DELAY_TIMEOUT));
+    }
+
+  }
+
+if (conf.synch_delay_enable && conf.synch_delay_value>0)       // if delay is switched on and greater than 0
+  {
+    for (count1=0;count1<conf.synch_delay_value+(conf.synch_delay_coarse_value*1000);count1++) // wait delay_value * 0.1ms
+    {
+      for (count2=0;count2<1400;count2++)            // delay approx. 0.1ms
+        {
+        }
+     }
+  }
+
+debug_led(0);
+*/
+
+asm volatile ("LDMFD SP!, {R0-R11,LR}\n"); // restore R0-R11 and LR from stack
+}
+
+static void __attribute__((noinline)) mykbd_task_proceed()
+{
+    while (physw_run){
+	_SleepTask(10);
+
+	if (wrap_kbd_p1_f() == 1){ // autorepeat ?
+	    _kbd_p2_f();
+	}
+    }
+}
+
+void __attribute__((naked,noinline))
+mykbd_task(long ua, long ub, long uc, long ud, long ue, long uf)
+{
+    /* WARNING
+     * Stack pointer manipulation performed here!
+     * This means (but not limited to):
+     *	function arguments destroyed;
+     *	function CAN NOT return properly;
+     *	MUST NOT call or use stack variables before stack
+     *	is setup properly;
+     *
+     */
+
+    register int i;
+    register long *newstack;
+
+#ifndef MALLOCD_STACK
+    newstack = (void*)kbd_stack;
+#else
+    newstack = malloc(NEW_SS);
+#endif
+
+    for (i=0;i<NEW_SS/4;i++)
+	newstack[i]=0xdededede;
+
+    asm volatile (
+	"MOV	SP, %0"
+	:: "r"(((char*)newstack)+NEW_SS)
+	: "memory"
+    );
+
+    mykbd_task_proceed();
+
+    /* function can be modified to restore SP here...
+     */
+
+    _ExitTask();
+}
+
+
+long __attribute__((naked,noinline)) wrap_kbd_p1_f()
+{
+
+    asm volatile(
+                "STMFD   SP!, {R4-R7,LR}\n"
+                "SUB     SP, SP, #0xC\n"
+                "BL      my_kbd_read_keys\n"
+		"B	 _kbd_p1_f_cont\n"
+    );
+    return 0; // shut up the compiler
+}
+
+
+void my_kbd_read_keys()
+{
+    kbd_prev_state[0] = kbd_new_state[0];
+    kbd_prev_state[1] = kbd_new_state[1];
+    kbd_prev_state[2] = kbd_new_state[2];
+
+    _platformsub_kbd_fetch_data(kbd_new_state);
+
+    if (kbd_process() == 0){
+	// leave it alone...
+	physw_status[0] = kbd_new_state[0];
+	physw_status[1] = kbd_new_state[1];
+	physw_status[2] = kbd_new_state[2];
+        physw_status[1] |= alt_mode_key_mask;
+    } else {
+	// override keys
+	physw_status[0] = (kbd_new_state[0] & (~KEYS_MASK0)) |
+			  (kbd_mod_state[0] & KEYS_MASK0);
+
+	physw_status[1] = (kbd_new_state[1] & (~KEYS_MASK1)) |
+			  (kbd_mod_state[1] & KEYS_MASK1);
+
+	physw_status[2] = (kbd_new_state[2] & (~KEYS_MASK2)) |
+			  (kbd_mod_state[2] & KEYS_MASK2);
+    }
+
+    _kbd_read_keys_r2(physw_status);
+    //usb_power=(physw_status[2] & USB_MASK)==USB_MASK;
+		remote_key = (physw_status[2] & USB_MASK)==USB_MASK;
+		if (remote_key) 
+			remote_count += 1;
+		else if (remote_count) {
+			usb_power = remote_count;
+			remote_count = 0;
+		}
+if (conf.remote_enable) {
+		physw_status[2] = physw_status[2] & ~(SD_READONLY_FLAG | USB_MASK);
+	}
+	else
+		physw_status[2] = physw_status[2] & ~SD_READONLY_FLAG;
+}
+
+int get_usb_power(int edge)
+{
+	int x;
+
+	if (edge) return remote_key;
+	x = usb_power;
+	usb_power = 0;
+	return x;
+}
+
+/****************/
+
+void kbd_set_alt_mode_key_mask(long key)
+{
+    int i;
+    for (i=0; keymap[i].hackkey; ++i) {
+	if (keymap[i].hackkey == key) {
+	    alt_mode_key_mask = keymap[i].canonkey;
+	    return;
+	}
+    }
+}
+
+void kbd_key_press(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    kbd_mod_state[keymap[i].grp] &= ~keymap[i].canonkey;
+	    return;
+	}
+    }
+}
+
+void kbd_key_release(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    kbd_mod_state[keymap[i].grp] |= keymap[i].canonkey;
+	    return;
+	}
+    }
+}
+
+void kbd_key_release_all()
+{
+  kbd_mod_state[0] |= KEYS_MASK0;
+  kbd_mod_state[1] |= KEYS_MASK1;
+  kbd_mod_state[2] |= KEYS_MASK2;
+}
+
+long kbd_is_key_pressed(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    return ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0) ? 1:0;
+	}
+    }
+    return 0;
+}
+
+long kbd_is_key_clicked(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    return ((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
+		    ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0);
+	}
+    }
+    return 0;
+}
+
+long kbd_get_pressed_key()
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0){
+	    return keymap[i].hackkey;
+	}
+    }
+    return 0;
+}
+
+long kbd_get_clicked_key()
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
+	    ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0)){
+	    return keymap[i].hackkey;
+	}
+    }
+    return 0;
+}
+
+void kbd_reset_autoclicked_key() {
+    last_kbd_key = 0;
+}
+
+long kbd_get_autoclicked_key() {
+    static long last_kbd_time = 0, press_count = 0;
+    register long key, t;
+
+    key=kbd_get_clicked_key();
+    if (key) {
+        last_kbd_key = key;
+        press_count = 0;
+        last_kbd_time = get_tick_count();
+        return key;
+    } else {
+        if (last_kbd_key && kbd_is_key_pressed(last_kbd_key)) {
+            t = get_tick_count();
+            if (t-last_kbd_time>((press_count)?175:500)) {
+                ++press_count;
+                last_kbd_time = t;
+                return last_kbd_key;
+            } else {
+                return 0;
+            }
+        } else {
+            last_kbd_key = 0;
+            return 0;
+        }
+    }
+}
+
+long kbd_use_zoom_as_mf() {
+    static long v;
+    static long zoom_key_pressed = 0;
+
+    if (kbd_is_key_pressed(KEY_ZOOM_IN) && kbd_is_key_pressed(KEY_MF) && (mode_get()&MODE_MASK) == MODE_REC) {
+        get_property_case(PROPCASE_FOCUS_MODE, &v, 4);
+        if (v) {
+            kbd_key_release_all();
+            kbd_key_press(KEY_MF);
+            kbd_key_press(KEY_UP);
+            zoom_key_pressed = KEY_ZOOM_IN;
+            return 1;
+        }
+    } else {
+        if (zoom_key_pressed==KEY_ZOOM_IN) {
+            kbd_key_release(KEY_UP);
+            zoom_key_pressed = 0;
+            return 1;
+        }
+    }
+    if (kbd_is_key_pressed(KEY_ZOOM_OUT) && kbd_is_key_pressed(KEY_MF) && (mode_get()&MODE_MASK) == MODE_REC) {
+        get_property_case(PROPCASE_FOCUS_MODE, &v, 4);
+        if (v) {
+            kbd_key_release_all();
+            kbd_key_press(KEY_MF);
+            kbd_key_press(KEY_DOWN);
+            zoom_key_pressed = KEY_ZOOM_OUT;
+            return 1;
+        }
+    } else {
+        if (zoom_key_pressed==KEY_ZOOM_OUT) {
+            kbd_key_release(KEY_DOWN);
+            zoom_key_pressed = 0;
+            return 1;
+        }
+    }
+    return 0;
+}
+static KeyMap keymap[] = {
+    /* tiny bug: key order matters. see kbd_get_pressed_key()
+     * for example
+     */
+	{ 1, KEY_UP		, 0x00020000 },
+	{ 1, KEY_DOWN		, 0x00080000 },
+	{ 1, KEY_LEFT		, 0x00010000 },
+	{ 1, KEY_RIGHT		, 0x00040000 },
+	{ 1, KEY_SET		, 0x00100000 },
+	{ 0, KEY_SHOOT_FULL	, 0x00000003 },
+	{ 0, KEY_SHOOT_HALF	, 0x00000001 },
+	{ 1, KEY_ZOOM_IN	, 0x10000000 },
+	{ 1, KEY_ZOOM_IN	, 0x18000000 },
+	{ 1, KEY_ZOOM_OUT	, 0x01000000 },
+	{ 1, KEY_ZOOM_OUT	, 0x05000000 },
+	{ 1, KEY_MENU		, 0x00200000 },
+	{ 1, KEY_DISPLAY	, 0x00002000 },
+	{ 1, KEY_PRINT		, 0x00004000 },
+	{ 1, KEY_ERASE		, 0x00400000 },
+        { 1, KEY_ISO		, 0x00001000 },
+        { 1, KEY_FLASH		, 0x00000008 },
+        { 1, KEY_MF		, 0x00000010 },
+        { 1, KEY_MACRO		, 0x00000020 },
+        { 1, KEY_VIDEO		, 0x40000000 },
+        { 1, KEY_TIMER		, 0x02000000 },
+//        { 1, KEY_DUMMY   	, 0x00000000 },
+	{ 0, 0, 0 }
+};
+
Index: /trunk/platform/s3is/wrappers.c
===================================================================
--- /trunk/platform/s3is/wrappers.c	(revision 511)
+++ /trunk/platform/s3is/wrappers.c	(revision 511)
@@ -0,0 +1,22 @@
+#include "../generic/wrappers.c"
+#include "keyboard.h"
+#include "conf.h"
+#include "platform.h"
+
+long lens_get_focus_pos()
+{
+    static long v=MAX_DIST;
+    return (kbd_is_key_pressed(KEY_SHOOT_HALF) || state_kbd_script_run  || shooting_get_focus_mode())?v=_GetFocusLensSubjectDistance():v;
+}
+
+long lens_get_focus_pos_from_lense()
+{
+    static long v=MAX_DIST;
+    return (kbd_is_key_pressed(KEY_SHOOT_HALF) || state_kbd_script_run  || shooting_get_focus_mode())?v=_GetFocusLensSubjectDistanceFromLens():v;
+}
+
+long lens_get_target_distance()
+{
+    static long v=MAX_DIST;
+    return (kbd_is_key_pressed(KEY_SHOOT_HALF) || state_kbd_script_run  || shooting_get_focus_mode())?v=_GetCurrentTargetDistance():v;
+}
Index: /trunk/platform/s3is/main.c
===================================================================
--- /trunk/platform/s3is/main.c	(revision 511)
+++ /trunk/platform/s3is/main.c	(revision 511)
@@ -0,0 +1,97 @@
+#include "../generic/main.c"
+
+long get_vbatt_min()
+{
+    return 4550;
+}
+
+long get_vbatt_max()
+{
+    return 5150;
+}
+
+static const struct {
+    int zp, fl;
+} fl_tbl[] = {
+    {   0,   6000 },
+    {  11,   6400 },
+    {  41,  12100 },
+    {  64,  21300 },
+    {  86,  41600 },
+    { 105,  61400 },
+    { 128,  72000 },
+};
+#define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0]))
+#define CF_EFL 6000
+
+const int zoom_points = 129;
+
+int get_effective_focal_length(int zp) {
+    return (CF_EFL*get_focal_length(zp))/1000;
+}
+
+int get_focal_length(int zp) {
+    int i;
+
+    if (zp<fl_tbl[0].zp)
+        return fl_tbl[0].fl;
+    else if (zp>fl_tbl[NUM_FL-1].zp)
+        return fl_tbl[NUM_FL-1].fl;
+    else 
+        for (i=1; i<NUM_FL; ++i) {
+           if (zp==fl_tbl[i-1].zp) 
+               return fl_tbl[i-1].fl;
+           else if (zp==fl_tbl[i].zp) 
+               return fl_tbl[i].fl;
+           else if (zp<fl_tbl[i].zp)
+               return fl_tbl[i-1].fl+(zp-fl_tbl[i-1].zp)*(fl_tbl[i].fl-fl_tbl[i-1].fl)/(fl_tbl[i].zp-fl_tbl[i-1].zp);
+        }
+    return fl_tbl[NUM_FL-1].fl;
+}
+
+int get_zoom_x(int zp) {
+    return get_focal_length(zp)*10/fl_tbl[0].fl;
+}
+
+static struct {
+	int hackmode;
+	int canonmode;
+} modemap[] = {
+    { MODE_AUTO,                32768 },
+    { MODE_P,                   32772 },
+    { MODE_TV,                  32771 },
+    { MODE_AV,                  32770 },
+    { MODE_M,                   32769 },
+    { MODE_PORTRAIT,            32781 },
+    { MODE_NIGHT,               32782 },
+    { MODE_LANDSCAPE,           32780 },
+    { MODE_VIDEO_STD,           2590  },
+    { MODE_STITCH,              33290 },
+    { MODE_MY_COLORS,           16921 },
+    { MODE_SCN_NIGHT,           16395 },
+    { MODE_SPORTS,		          32775 },
+    { MODE_SCN_PARTY,           16400 },
+    { MODE_SCN_GRASS,           16401 },
+    { MODE_SCN_SNOW,            16402 },
+    { MODE_SCN_BEACH,           16403 },
+    { MODE_SCN_FIREWORK,        16404 }, 
+    { MODE_SCN_COLOR_ACCENT,    16920 } 
+};
+#define MODESCNT (sizeof(modemap)/sizeof(modemap[0]))
+
+int mode_get() {
+    int mode, i, t=0xFF;
+
+    mode  = (playrec_mode==2 || playrec_mode==5)?MODE_REC:MODE_PLAY;
+    mode |= (physw_status[1] & 0x00000001)?0:MODE_SCREEN_OPENED;
+    mode |= (physw_status[1] & 0x00000002)?0:MODE_SCREEN_ROTATED;
+    
+    t=0xFF;
+    _GetPropertyCase(PROPCASE_SHOOTING_MODE, &t, 4);
+    for (i=0; i<MODESCNT; ++i) {
+	if (modemap[i].canonmode == t) {
+	    return (mode | (modemap[i].hackmode & MODE_SHOOTING_MASK));
+	}
+    }
+    return (mode);
+}
Index: /trunk/platform/s3is/notes.txt
===================================================================
--- /trunk/platform/s3is/notes.txt	(revision 511)
+++ /trunk/platform/s3is/notes.txt	(revision 511)
@@ -0,0 +1,9 @@
+****************************************
+
+Camera depending notes: 
+
+- s3is uses Propset 1 of Properties (see http://tinyurl.com/6zbv9b)
+- s3is does have a REAL IRIS Diaphragm, it does NOT have an an ND Filter! 
+Mind this.
+- cam supports multipartitions
+
Index: /trunk/platform/s3is/lib.c
===================================================================
--- /trunk/platform/s3is/lib.c	(revision 511)
+++ /trunk/platform/s3is/lib.c	(revision 511)
@@ -0,0 +1,76 @@
+#include "platform.h"
+#include "lolevel.h"
+
+void shutdown()
+{
+    volatile long *p = (void*)0xc022002c;
+        
+    asm(
+         "MRS     R1, CPSR\n"
+         "AND     R0, R1, #0x80\n"
+         "ORR     R1, R1, #0x80\n"
+         "MSR     CPSR_cf, R1\n"
+         :::"r1","r0");
+        
+    *p = 0x46;
+
+    while(1);
+}
+
+
+#define LED_PR 0xc0220088
+
+#define LED_BRIGHTNESS  200
+#define LED_GREEN       4
+#define LED_YELLOW      5
+#define LED_ORANGE      7
+#define LED_BLUE        8
+#define LED_AF_BEAM     9
+#define LED_TIMER       10
+  
+static void led_on(const int led, const int brightness)
+{
+    if (led < 4 || led > 10 || led == 6) return;
+    static void* addr;
+    addr = led_table + (led * 0x40);
+    _UniqueLedOn(addr,brightness);
+}
+ 
+static void led_off(const int led)
+{
+    if (led < 4 || led > 10 || led == 6) return;
+    static void* addr;
+    addr = led_table + (led * 0x40);
+    _UniqueLedOff(addr);
+}
+
+void debug_led(int state)
+{
+    if (state)
+        led_on(LED_BLUE, LED_BRIGHTNESS);
+    else
+        led_off(LED_BLUE);
+}
+
+int get_flash_params_count(void){
+ return 108;
+}
+
+
+void ubasic_set_led(int led, int state, int bright)
+{
+	if (state) {
+		if (bright > LED_BRIGHTNESS) bright = LED_BRIGHTNESS;
+		if (led == 6) { // yellow = red + green
+	        led_on(4, bright);
+		    led_on(5, bright);
+		} else
+			led_on(led, bright);
+	}
+    else
+		if (led == 6) {
+	        led_off(4);
+		    led_off(5);
+		} else
+        led_off(led);
+}
Index: /trunk/platform/s3is/sub/100a/capt_seq.c
===================================================================
--- /trunk/platform/s3is/sub/100a/capt_seq.c	(revision 511)
+++ /trunk/platform/s3is/sub/100a/capt_seq.c	(revision 511)
@@ -0,0 +1,412 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+#define RAWDATA_AVAILABLE (1)
+#define RAWDATA_SAVED (2)
+
+#define NR_ON (2)
+#define NR_OFF (1)
+
+static long raw_save_stage;
+
+void capt_seq_hook_raw_here()
+{
+    raw_save_stage = RAWDATA_AVAILABLE;
+    core_rawdata_available();
+    while (raw_save_stage != RAWDATA_SAVED){
+	_SleepTask(10);
+    }
+}
+
+void hook_raw_save_complete()
+{
+    raw_save_stage = RAWDATA_SAVED;
+}
+
+
+void capt_seq_hook_set_nr()
+{
+    long *nrflag = (long*)0x6688;
+
+    switch (core_get_noise_reduction_value()){
+    case NOISE_REDUCTION_AUTO_CANON:
+	// leave it alone
+	break;
+    case NOISE_REDUCTION_OFF:
+	*nrflag = 1;
+	break;
+    case NOISE_REDUCTION_ON:
+	*nrflag = 2;
+	break;
+    };
+}
+
+
+void __attribute__((naked,noinline)) sub_FF97DD78_my(long p)
+{
+    asm volatile (
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "LDR     R3, =0x6193C\n"
+                "LDR     R5, =0x6684\n"
+                "SUB     SP, SP, #4\n"
+                "LDR     R1, =0xFFFFFFFF\n"
+                "STR     R0, [R5]\n"
+                "LDR     R0, [R3]\n"
+                "BL      sub_FF81FF40\n"
+                "LDR     R3, =0x92DE0\n"
+                "LDR     R0, [R3,#0x74]\n"
+                //"BL      nullsub_31\n"
+                "BL      sub_FF97DCCC\n"
+         //   "BL      wait_until_remote_button_is_released\n"
+	    	"BL      capt_seq_hook_set_nr\n"
+                "LDR     R3, =0x668C\n"
+                "LDR     R0, [R3]\n"
+
+		"B       sub_FF97DDB0\n"
+    );
+}
+
+void __attribute__((naked,noinline)) sub_FF97A124_my(long p)
+{
+    asm volatile (
+                "STMFD   SP!, {R4-R7,LR}\n"
+                "LDR     R4, [R0,#0xC]\n"
+                "BL      sub_FF983D84\n"
+                "CMP     R0, #0\n"
+                "BNE     loc_FF97A13C\n"
+                "BL      sub_FF983D90\n"
+"loc_FF97A13C:\n"
+                "LDR     R1, =0x92DE0\n"
+                "MOV     R3, #0x8000\n"
+                "LDRH    R2, [R1]\n"
+                "ADD     R3, R3, #7\n"
+                "CMP     R2, R3\n"
+                "BNE     loc_FF97A198\n"
+                "LDRH    R3, [R1,#0x80]\n"
+                "CMP     R3, #3\n"
+                "BEQ     loc_FF97A198\n"
+                "LDRH    R3, [R1,#0x7E]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FF97A198\n"
+                "LDRH    R3, [R1,#0x7A]\n"
+                "CMP     R3, #1\n"
+                "BNE     loc_FF97A198\n"
+                "LDR     R2, =0x92E80\n"
+                "LDR     R3, [R2,#0x1C]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FF97A198\n"
+                "LDR     R3, [R2,#0x18]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FF97A198\n"
+                "BL      sub_FF97D9C4\n"
+"loc_FF97A198:\n"
+                "MOV     R0, #0xC\n"
+                "BL      sub_FF983DA4\n"
+                "TST     R0, #1\n"
+                "BEQ     loc_FF97A1BC\n"
+                "MOV     R0, #1\n"
+"loc_FF97A1AC:\n"
+                "MOV     R2, R4\n"
+                "MOV     R1, #1\n"
+                "LDMFD   SP!, {R4-R7,LR}\n"
+                "B       sub_FF9783E4\n"
+"loc_FF97A1BC:\n"
+                "MOV     R0, #2\n"
+                "LDR     R6, =0x92D20\n"
+                "BL      sub_FFB01384\n"
+                "ADD     R3, R4, R4,LSL#1\n"
+                "MOV     R5, R3,LSL#5\n"
+                "ADD     R7, R6, #8\n"
+                "LDR     R3, [R7,R5]\n"
+                "CMP     R3, #0\n"
+                "BEQ     loc_FF97A1E4\n"
+                "BL      sub_FF962E94\n"
+"loc_FF97A1E4:\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF97C7B8\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF97C7F4\n"
+                "TST     R0, #1\n"
+                "BNE     loc_FF97A1AC\n"
+                "BL      sub_FF9C0724\n"
+                "BL      sub_FF824B88\n"
+                "ADD     R3, R6, #4\n"
+                "STR     R0, [R3,R5]\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF97E4FC\n"
+                "BL      sub_FF97CD9C\n"
+                "BL      sub_FF97CD38\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF97DD78_my\n"
+                "BL      capt_seq_hook_raw_here\n"
+                "MOV     R1, #1\n"
+                "MOV     R2, R4\n"
+                "BL      sub_FF9783E4\n"
+                "BL      sub_FF97DF88\n"
+                "LDR     R3, [R7,R5]\n"
+                "CMP     R3, #0\n"
+                "BEQ     loc_FF97A244\n"
+                "BL      sub_FF962EB4\n"
+"loc_FF97A244:\n"
+                "LDR     R1, =0x92DE0\n"
+                "MOV     R3, #0x8000\n"
+                "LDRH    R2, [R1]\n"
+                "ADD     R3, R3, #7\n"
+                "CMP     R2, R3\n"
+                "LDMNEFD SP!, {R4-R7,PC}\n"
+                "LDRH    R3, [R1,#0x80]\n"
+                "CMP     R3, #3\n"
+                "LDMEQFD SP!, {R4-R7,PC}\n"
+                "LDRH    R3, [R1,#0x7E]\n"
+                "CMP     R3, #0\n"
+                "LDMNEFD SP!, {R4-R7,PC}\n"
+                "LDRH    R3, [R1,#0x7A]\n"
+                "CMP     R3, #1\n"
+                "LDMNEFD SP!, {R4-R7,PC}\n"
+                "LDR     R2, =0x92E80\n"
+                "LDR     R3, [R2,#0x1C]\n"
+                "CMP     R3, #0\n"
+                "LDMNEFD SP!, {R4-R7,PC}\n"
+                "LDR     R3, [R2,#0x18]\n"
+                "CMP     R3, #0\n"
+                "LDMNEFD SP!, {R4-R7,PC}\n"
+                "MOV     R0, R4\n"
+                "LDMFD   SP!, {R4-R7,LR}\n"
+                "B       sub_FF97D970\n"
+    );
+}
+
+void __attribute__((naked,noinline)) capt_seq_task()
+{
+	asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                "SUB     SP, SP, #4\n"
+                "MOV     R4, SP\n"
+                "B       loc_FF97A8F8\n"
+"loc_FF97A630:\n"
+                "LDR     R1, [SP,#0xC-0xC]\n"
+                "LDR     R3, [R1]\n"
+                "MOV     R0, R1\n"
+                "CMP     R3, #0x15\n"
+                "LDRLS   PC, [PC,R3,LSL#2]\n"
+                "B       loc_FF97A8D0\n"
+                ".long loc_FF97A6A0\n"
+                ".long loc_FF97A6AC\n"
+                ".long loc_FF97A6B4\n"
+                ".long loc_FF97A720\n"
+                ".long loc_FF97A718\n"
+                ".long loc_FF97A784\n"
+                ".long loc_FF97A7E8\n"
+                ".long loc_FF97A7F4\n"
+                ".long loc_FF97A7FC\n"
+                ".long loc_FF97A808\n"
+                ".long loc_FF97A810\n"
+                ".long loc_FF97A818\n"
+                ".long loc_FF97A820\n"
+                ".long loc_FF97A828\n"
+                ".long loc_FF97A830\n"
+                ".long loc_FF97A83C\n"
+                ".long loc_FF97A844\n"
+                ".long loc_FF97A84C\n"
+                ".long loc_FF97A854\n"
+                ".long loc_FF97A860\n"
+                ".long loc_FF97A868\n"
+                ".long loc_FF97A870\n"
+"loc_FF97A6A0:\n"
+                "BL      sub_FF97C09C\n"
+                "BL      shooting_expo_param_override\n"  // +
+                "BL      sub_FF977E9C\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A6AC:\n"
+                "BL      sub_FF97A124_my\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A6B4:\n"
+                "LDR     R1, =0x92DE0\n"
+                "MOV     R3, #0x8000\n"
+                "LDRH    R2, [R1]\n"
+                "ADD     R3, R3, #7\n"
+                "CMP     R2, R3\n"
+                "BNE     loc_FF97A710\n"
+                "LDRH    R3, [R1,#0x80]\n"
+                "CMP     R3, #3\n"
+                "BEQ     loc_FF97A710\n"
+                "LDRH    R3, [R1,#0x7E]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FF97A710\n"
+                "LDRH    R3, [R1,#0x7A]\n"
+                "CMP     R3, #1\n"
+                "BNE     loc_FF97A710\n"
+                "LDR     R2, =0x92E80\n"
+                "LDR     R3, [R2,#0x1C]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FF97A710\n"
+                "LDR     R3, [R2,#0x18]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FF97A710\n"
+                "BL      sub_FF97D9C4\n"
+"loc_FF97A710:\n"
+                "BL      sub_FF97C7A8\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A718:\n"
+                "BL      sub_FF97B384\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A720:\n"
+                "LDR     R1, =0x92DE0\n"
+                "MOV     R3, #0x8000\n"
+                "LDRH    R2, [R1]\n"
+                "ADD     R3, R3, #7\n"
+                "CMP     R2, R3\n"
+                "BNE     loc_FF97A77C\n"
+                "LDRH    R3, [R1,#0x80]\n"
+                "CMP     R3, #3\n"
+                "BEQ     loc_FF97A77C\n"
+                "LDRH    R3, [R1,#0x7E]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FF97A77C\n"
+                "LDRH    R3, [R1,#0x7A]\n"
+                "CMP     R3, #1\n"
+                "BNE     loc_FF97A77C\n"
+                "LDR     R2, =0x92E80\n"
+                "LDR     R3, [R2,#0x1C]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FF97A77C\n"
+                "LDR     R3, [R2,#0x18]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FF97A77C\n"
+                "BL      sub_FF97D9C4\n"
+"loc_FF97A77C:\n"
+                "BL      sub_FF97B724\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A784:\n"
+                "LDR     R1, =0x92DE0\n"
+                "MOV     R3, #0x8000\n"
+                "LDRH    R2, [R1]\n"
+                "ADD     R3, R3, #7\n"
+                "CMP     R2, R3\n"
+                "BNE     loc_FF97A7E0\n"
+                "LDRH    R3, [R1,#0x80]\n"
+                "CMP     R3, #3\n"
+                "BEQ     loc_FF97A7E0\n"
+                "LDRH    R3, [R1,#0x7E]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FF97A7E0\n"
+                "LDRH    R3, [R1,#0x7A]\n"
+                "CMP     R3, #1\n"
+                "BNE     loc_FF97A7E0\n"
+                "LDR     R2, =0x92E80\n"
+                "LDR     R3, [R2,#0x1C]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FF97A7E0\n"
+                "LDR     R3, [R2,#0x18]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FF97A7E0\n"
+                "BL      sub_FF97D9C4\n"
+"loc_FF97A7E0:\n"
+                "BL      sub_FF97B734\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A7E8:\n"
+                "BL      sub_FF97C180\n"
+                "BL      sub_FF977E9C\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A7F4:\n"
+                "BL      sub_FF97A320\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A7FC:\n"
+                "BL      sub_FF97C1E8\n"
+                "BL      sub_FF977E9C\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A808:\n"
+                "BL      sub_FF97B724\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A810:\n"
+                "BL      sub_FF97CDDC\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A818:\n"
+                "BL      sub_FF97D120\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A820:\n"
+                "BL      sub_FF97D1A4\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A828:\n"
+                "BL      sub_FF97D2A0\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A830:\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FF97D368\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A83C:\n"
+                "BL      sub_FF97D504\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A844:\n"
+                "BL      sub_FF97D598\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A84C:\n"
+                "BL      sub_FF97D654\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A854:\n"
+                "MOV     R0, #1\n"
+                "BL      sub_FF97D368\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A860:\n"
+                "BL      sub_FF97D740\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A868:\n"
+                "BL      sub_FF97D810\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A870:\n"
+                "LDR     R0, =0x92DE0\n"
+                "MOV     R3, #0x8000\n"
+                "LDRH    R2, [R0]\n"
+                "ADD     R3, R3, #7\n"
+                "CMP     R2, R3\n"
+                "BNE     loc_FF97A8E0\n"
+                "LDRH    R3, [R0,#0x80]\n"
+                "CMP     R3, #3\n"
+                "BEQ     loc_FF97A8E0\n"
+                "LDRH    R3, [R0,#0x7E]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FF97A8E0\n"
+                "LDRH    R3, [R0,#0x7A]\n"
+                "CMP     R3, #1\n"
+                "BNE     loc_FF97A8E0\n"
+                "LDR     R2, =0x92E80\n"
+                "LDR     R3, [R2,#0x1C]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FF97A8E0\n"
+                "LDR     R3, [R2,#0x18]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FF97A8E0\n"
+                "BL      sub_FF97D9C4\n"
+                "B       loc_FF97A8DC\n"
+"loc_FF97A8D0:\n"
+                "MOV     R1, #0x36C\n"
+                "LDR     R0, =0xFF979EB0\n"
+                "BL      sub_FF813B80\n"
+"loc_FF97A8DC:\n"
+                "LDR     R1, [SP,#0xC-0xC]\n"
+"loc_FF97A8E0:\n"
+                "LDR     R3, =0x618C4\n"
+                "LDR     R1, [R1,#4]\n"
+                "LDR     R0, [R3]\n"
+                "BL      sub_FF81FDA4\n"
+                "LDR     R0, [SP,#0xC-0xC]\n"
+                "BL      sub_FF979F2C\n"
+"loc_FF97A8F8:\n"
+                "LDR     R3, =0x618C8\n"
+                "MOV     R1, R4\n"
+                "LDR     R0, [R3]\n"
+                "MOV     R2, #0\n"
+                "BL      sub_FF8204BC\n"
+                "TST     R0, #1\n"
+                "BEQ     loc_FF97A630\n"
+                "MOV     R1, #0x2A4\n"
+                "LDR     R0, =0xFF979EB0\n"
+                "ADD     R1, R1, #2\n"
+                "BL      sub_FF813B80\n"
+                "BL      sub_FF821A18\n"
+                "ADD     SP, SP, #4\n"
+                "LDMFD   SP!, {R4,PC}\n"
+	);
+}
+
Index: /trunk/platform/s3is/sub/100a/stubs_entry.S
===================================================================
--- /trunk/platform/s3is/sub/100a/stubs_entry.S	(revision 511)
+++ /trunk/platform/s3is/sub/100a/stubs_entry.S	(revision 511)
@@ -0,0 +1,174 @@
+// !!! THIS FILE IS GENERATED. DO NOT EDIT. !!!
+#include "stubs_asm.h"
+
+NSTUB(AllocateMemory, 0xff811ac4)
+NSTUB(AllocateUncacheableMemory, 0xff814cb0)
+NSTUB(Close, 0xff8713c4)
+NSTUB(CreatePhysicalVram, 0xff942824)
+NSTUB(CreateTask, 0xff821658)
+NSTUB(CreateTaskStrict, 0xff8226f8)
+NSTUB(DisableDispatch, 0xff82147c)
+// Best match: 96%
+NSTUB(DisplayImagePhysicalScreen, 0xff941b58)
+NSTUB(EnableDispatch, 0xff821508)
+NSTUB(ExecuteEventProcedure, 0xff816bc8)
+NSTUB(ExitTask, 0xff821a18)
+NSTUB(Fclose_Fut, 0xff86a104)
+NSTUB(Fopen_Fut, 0xff86a0c8)
+NSTUB(Fread_Fut, 0xff86a1e8)
+NSTUB(FreeMemory, 0xff811ad0)
+NSTUB(FreeUncacheableMemory, 0xff814ce4)
+NSTUB(Fseek_Fut, 0xff86a2d0)
+NSTUB(Fwrite_Fut, 0xff86a238)
+NSTUB(GetCurrentAvValue, 0xffb0a538)
+// ALT: NSTUB(GetCurrentAvValue, 0xffb0c5dc) // 13/0
+NSTUB(GetCurrentTargetDistance, 0xffb0c584)
+// Best match: 83%
+NSTUB(GetFocusLensSubjectDistance, 0xffaf007c)
+// ALT: NSTUB(GetFocusLensSubjectDistance, 0xffaf007c) // 26/5
+// Best match: 52%
+NSTUB(GetFocusLensSubjectDistanceFromLens, 0xffaf05f4)
+// Best match: 86%
+NSTUB(GetParameterData, 0xff994b68)
+NSTUB(GetPropertyCase, 0xff82498c)
+// Best match: 96%
+NSTUB(GetSystemTime, 0xff814ee8)
+// ALT: NSTUB(GetSystemTime, 0xff814ee8) // 26/1
+// Best match: 68%
+NSTUB(GetZoomLensCurrentPoint, 0xffae8474)
+// ALT: NSTUB(GetZoomLensCurrentPoint, 0xffae8474) // 20/9
+// Best match: 51%
+NSTUB(GetZoomLensCurrentPosition, 0xffae8488)
+// ALT: NSTUB(GetZoomLensCurrentPosition, 0xffae8488) // 15/14
+NSTUB(IsStrobeChargeCompleted, 0xff91d8c0)
+NSTUB(LockMainPower, 0xff98f118)
+NSTUB(MakeDirectory, 0xff871668)
+// Best match: 73%
+NSTUB(Mount_FileSystem, 0xff870190)
+// ALT: NSTUB(Mount_FileSystem, 0xff870190) // 22/8
+// Best match: 96%
+NSTUB(MoveFocusLensToDistance, 0xffb0c824)
+// ERROR: MoveZoomLensWithPoint is not found!
+NSTUB(Open, 0xff87139c)
+// Best match: 89%
+NSTUB(PhySw_testgpio, 0xff82835c)
+NSTUB(ProtectFile, 0xff869730)
+// Best match: 92%
+NSTUB(PutInNdFilter, 0xffb0a54c)
+// ALT: NSTUB(PutInNdFilter, 0xffb0a54c) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffb0a594) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffb0a594) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffb0a958) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffb0a958) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffb0c1cc) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffb0c1cc) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffb0c214) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffb0c214) // 25/2
+// Best match: 94%
+NSTUB(PutOutNdFilter, 0xffb0a9a0)
+// ALT: NSTUB(PutOutNdFilter, 0xffb0a9a0) // 16/1
+NSTUB(Read, 0xff871458)
+NSTUB(RefreshPhysicalScreen, 0xff9a7b10)
+NSTUB(Remove, 0xff8713e4)
+NSTUB(SetAutoShutdownTime, 0xff98f01c)
+// Best match: 86%
+NSTUB(SetParameterData, 0xff994a88)
+NSTUB(SetPropertyCase, 0xff824870)
+NSTUB(SleepTask, 0xff82156c)
+NSTUB(TakeSemaphore, 0xff821068)
+NSTUB(UnlockMainPower, 0xff98f1b0)
+NSTUB(Unmount_FileSystem, 0xff870244)
+// ERROR: UnsetZoomForMovie is not found!
+NSTUB(UpdateMBROnFlash, 0xff8703ec)
+// ERROR: VbattGet is not found!
+NSTUB(Write, 0xff871464)
+NSTUB(_log, 0xffb496c0)
+// ALT: NSTUB(_log, 0xffb496c0) // 27/0
+NSTUB(_log10, 0xffb45a60)
+// ALT: NSTUB(_log10, 0xffb45a60) // 27/0
+NSTUB(_pow, 0xffb45be8)
+// ALT: NSTUB(_pow, 0xffb45be8) // 25/0
+NSTUB(_sqrt, 0xffb47abc)
+// ALT: NSTUB(_sqrt, 0xffb47abc) // 24/0
+NSTUB(chdir, 0xffb54858)
+// ALT: NSTUB(chdir, 0xffb54858) // 27/0
+NSTUB(close, 0xffb54198)
+NSTUB(closedir, 0xffb51620)
+// ERROR: free is not found!
+NSTUB(ints_disable, 0xff81dad8)
+NSTUB(ints_enable, 0xff81dae4)
+NSTUB(ioctl, 0xffb542d8)
+NSTUB(iosDevAdd, 0xffb553b8)
+NSTUB(iosDrvInstall, 0xffb5567c)
+NSTUB(isalpha, 0xffb4b6c4)
+// ALT: NSTUB(isalpha, 0xffb4b6c4) // 4/0
+NSTUB(isdigit, 0xffb4b6f4)
+// ALT: NSTUB(isdigit, 0xffb4b6f4) // 4/0
+NSTUB(islower, 0xffb4b724)
+// ALT: NSTUB(islower, 0xffb4b724) // 4/0
+NSTUB(isspace, 0xffb4b76c)
+// ALT: NSTUB(isspace, 0xffb4b76c) // 4/0
+NSTUB(isupper, 0xffb4b784)
+// ALT: NSTUB(isupper, 0xffb4b784) // 4/0
+NSTUB(kbd_p1_f, 0xff826d64)
+NSTUB(kbd_p1_f_cont, 0xff826d70)
+NSTUB(kbd_p2_f, 0xff827140)
+// Best match: 83%
+NSTUB(kbd_pwr_off, 0xff82956c)
+// ALT: NSTUB(kbd_pwr_off, 0xff829588) // 5/1
+// Best match: 55%
+NSTUB(kbd_pwr_on, 0xff944170)
+// ALT: NSTUB(kbd_pwr_on, 0xff94419c) // 5/4
+// Best match: 57%
+NSTUB(kbd_read_keys_r2, 0xff827bf0)
+// Best match: 93%
+NSTUB(localtime, 0xffb4fe14)
+NSTUB(lseek, 0xffb542dc)
+// Best match: 53%
+NSTUB(malloc, 0xffb571d8)
+// ALT: NSTUB(malloc, 0xffb571d8) // 15/13
+NSTUB(memcmp, 0xffb4f1f4)
+// ALT: NSTUB(memcmp, 0xffb5bdb8) // 9/0
+NSTUB(memcpy, 0xffb4f230)
+NSTUB(memset, 0xffb4f2a8)
+NSTUB(mkdir, 0xff8715ac)
+NSTUB(open, 0xffb547dc)
+NSTUB(opendir, 0xffb51654)
+NSTUB(qsort, 0xffb4ea54)
+NSTUB(rand, 0xffb4ea78)
+// ALT: NSTUB(rand, 0xffb4ea78) // 8/0
+NSTUB(read, 0xffb541f8)
+NSTUB(readdir, 0xffb515ec)
+NSTUB(rename, 0xffb547e4)
+// ALT: NSTUB(rename, 0xffb547e4) // 26/0
+NSTUB(rewinddir, 0xffb51614)
+NSTUB(srand, 0xffb4ea9c)
+// ALT: NSTUB(srand, 0xffb4ea9c) // 4/0
+NSTUB(stat, 0xffb516e8)
+NSTUB(strcat, 0xffb4f2c8)
+NSTUB(strchr, 0xffb4f2f4)
+NSTUB(strcmp, 0xffb4f318)
+NSTUB(strcpy, 0xffb4f4ac)
+NSTUB(strlen, 0xffb4f610)
+NSTUB(strncmp, 0xffb4f674)
+NSTUB(strncpy, 0xffb4f6b8)
+// ALT: NSTUB(strncpy, 0xffb4f6b8) // 24/0
+NSTUB(strpbrk, 0xffb4f700)
+NSTUB(strrchr, 0xffb4f73c)
+// ALT: NSTUB(strrchr, 0xffb4f73c) // 8/0
+NSTUB(strtol, 0xffb4ee90)
+NSTUB(taskCreateHookAdd, 0xffb5a858)
+NSTUB(taskDeleteHookAdd, 0xffb5a794)
+// Best match: 82%
+NSTUB(taskIdListGet, 0xffb64820)
+NSTUB(taskLock, 0xffb64edc)
+NSTUB(taskName, 0xffb64718)
+NSTUB(taskResume, 0xffb64afc)
+NSTUB(taskSuspend, 0xffb64928)
+NSTUB(taskUnlock, 0xffb64f84)
+NSTUB(time, 0xffb50b60)
+// ALT: NSTUB(time, 0xffb50b60) // 25/0
+NSTUB(utime, 0xffb5177c)
+// ALT: NSTUB(utime, 0xffb5177c) // 26/0
+NSTUB(vsprintf, 0xffb52f40)
+NSTUB(write, 0xffb54268)
Index: /trunk/platform/s3is/sub/100a/mount.c
===================================================================
--- /trunk/platform/s3is/sub/100a/mount.c	(revision 511)
+++ /trunk/platform/s3is/sub/100a/mount.c	(revision 511)
@@ -0,0 +1,228 @@
+void __attribute__((naked,noinline)) init_file_modules_task(){
+ asm volatile(
+                "STMFD   SP!, {R4,LR}\n"
+                "BL      _Unmount_FileSystem\n" // + 
+                "BL      sub_FFB37368\n"
+                "SUBS    R4, R0, #0\n"
+                "MOV     R0, #0x5000\n"
+                "MOV     R1, #0\n"
+                "ADD     R0, R0, #6\n"
+                "BEQ     loc_FF9BD42C\n"
+                "BL      sub_FF98B0C4\n"
+"loc_FF9BD42C:\n"
+                "BL      sub_FFB373E0_my\n"  //------------->
+                "MOV     R0, #0x5000\n"
+                "CMP     R4, #0\n"
+                "MOV     R1, R4\n"
+                "ADD     R0, R0, #6\n"
+                "LDMNEFD SP!, {R4,PC}\n"
+                "LDMFD   SP!, {R4,LR}\n"
+                "B       sub_FF98B0C4\n"
+ );
+}
+
+void __attribute__((naked,noinline)) sub_FFB373E0_my(){
+ asm volatile(
+                "STMFD   SP!, {R4,LR}\n"
+                "LDR     R4, =0xB99C\n"
+                "BL      Mount_FileSystem_my\n"  //------------------->
+                "LDR     R3, [R4]\n"
+                "CMP     R3, #0\n"
+                "MOV     R0, #0\n"
+                "BEQ     loc_FFB37404\n"
+                "BL      sub_FF86E6E4\n"
+                "LDR     R3, [R4]\n"
+"loc_FFB37404:\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FFB37430\n"
+                "BL      sub_FF9E6838\n"
+                "AND     R0, R0, #0xFF\n"
+                "BL      sub_FF834454\n"
+                "BL      sub_FF9E6838\n"
+                "AND     R0, R0, #0xFF\n"
+                "BL      sub_FF864E7C\n"
+                "BL      sub_FF9E6848\n"
+                "AND     R0, R0, #0xFF\n"
+                "BL      sub_FF834528\n"
+"loc_FFB37430:\n"
+                "LDR     R2, =0xB998\n"
+                "MOV     R3, #1\n"
+                "STR     R3, [R2]\n"
+                "LDMFD   SP!, {R4,PC}\n"
+ );
+}
+
+void __attribute__((naked,noinline)) Mount_FileSystem_my(){
+ asm volatile(
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "MOV     R5, #0\n"
+                "LDR     R6, =0x2BFF8\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FF86FBC8\n"
+                "LDR     R0, [R6,#0x38]\n"
+                "BL      sub_FF86F2B8\n"
+                "SUBS    R1, R0, #0\n"
+                "MOV     R0, R5\n"
+                "BNE     loc_FF8701D0\n"
+                "LDR     R3, =0x2A28\n"
+                "LDR     R2, =0x2A20\n"
+                "STR     R1, [R3]\n"
+                "LDR     R3, =0x2A24\n"
+                "STR     R1, [R2]\n"
+                "STR     R1, [R3]\n"
+"loc_FF8701D0:\n"
+                "BL      sub_FF86FC18\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FF86FF40_my\n"  //----------------------->
+                "MOV     R4, R0\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FF86FFC8\n"
+                "AND     R4, R4, R0\n"
+                "MOV     R2, R4\n"
+                "MOV     R0, R6\n"
+                "LDR     R1, [R6,#0x3C]\n"
+                "BL      sub_FF870140\n"
+                "LDR     R2, =0x2A10\n"
+                "MOV     R3, #1\n"
+                "STR     R0, [R6,#0x40]\n"
+                "STR     R3, [R2]\n"
+                "LDMFD   SP!, {R4-R6,PC}\n"
+ );
+}
+
+void __attribute__((naked,noinline)) sub_FF86FF40_my(){
+ asm volatile(
+                "STMFD   SP!, {R4-R7,LR}\n"
+                "LDR     R7, =0x2A24\n"
+                "LDR     R3, [R7]\n"
+                "MOV     R4, R0\n"
+                "CMP     R3, #0\n"
+                "ADD     R3, R4, R4,LSL#1\n"
+                "RSB     R3, R4, R3,LSL#3\n"
+                "LDR     R6, =0x2C030\n"
+                "MOV     R5, R3,LSL#2\n"
+                "MOV     R1, R4\n"
+                "BNE     loc_FF86FFB4\n"
+                "LDR     R0, [R6,R5]\n"
+                "BL      sub_FF86FCD4_my\n"     //----------------------------->
+                "SUBS    R3, R0, #0\n"
+                "MOV     R1, R4\n"
+                "BEQ     loc_FF86FF8C\n"
+                "LDR     R0, [R6,R5]\n"
+                "BL      sub_FF86FE24\n"
+                "MOV     R3, R0\n"
+"loc_FF86FF8C:\n"
+                "CMP     R3, #0\n"
+                "MOV     R0, R4\n"
+                "BEQ     loc_FF86FFA0\n"
+                "BL      sub_FF86F390\n"
+                "MOV     R3, R0\n"
+"loc_FF86FFA0:\n"
+                "CMP     R3, #0\n"
+                "MOV     R0, R3\n"
+                "MOVNE   R3, #1\n"
+                "STRNE   R3, [R7]\n"
+                "LDMFD   SP!, {R4-R7,PC}\n"
+"loc_FF86FFB4:\n"
+                "MOV     R0, #1\n"
+                "LDMFD   SP!, {R4-R7,PC}\n"
+
+
+ );
+}
+
+void __attribute__((naked,noinline)) sub_FF86FCD4_my(){
+ asm volatile(
+                "STMFD   SP!, {R4-R8,LR}\n"
+                "MOV     R5, R1\n"
+                "MOV     R8, R5,LSL#1\n"
+                "ADD     R3, R8, R5\n"
+                "LDR     R2, =0x2C034\n"
+                "SUB     SP, SP, #8\n"
+                "RSB     R3, R5, R3,LSL#3\n"
+                "LDR     R1, [R2,R3,LSL#2]\n"
+                "MOV     R6, #0\n"
+                "STR     R6, [SP]\n"
+                "MOV     R7, R0\n"
+                "STR     R6, [SP,#4]\n"
+                "CMP     R1, #5\n"
+                "LDRLS   PC, [PC,R1,LSL#2]\n"
+                "B       loc_FF86FDD0\n"
+                ".long loc_FF86FD74\n"
+                ".long loc_FF86FD28\n"
+                ".long loc_FF86FD28\n"
+                ".long loc_FF86FD28\n"
+                ".long loc_FF86FD28\n"
+                ".long loc_FF86FDC0\n"
+"loc_FF86FD28:\n"
+                "MOV     R0, #3\n"
+                "MOV     R1, #0x200\n"
+                "MOV     R2, #0\n"
+                "BL      sub_FF81282C\n"
+                "SUBS    R6, R0, #0\n"
+                "BEQ     loc_FF86FE08\n"
+                "ADD     R12, R8, R5\n"
+                "RSB     R12, R5, R12,LSL#3\n"
+                "LDR     R4, =0x2C044\n"
+                "MOV     R0, R7\n"
+                "MOV     R1, #0\n"
+                "MOV     R2, #1\n"
+                "MOV     R3, R6\n"
+                "MOV     LR, PC\n"
+                "LDR     PC, [R4,R12,LSL#2]\n"
+                "CMP     R0, #1\n"
+                "BNE     loc_FF86FD7C\n"
+                "MOV     R0, #3\n"
+                "BL      sub_FF8128FC\n"
+"loc_FF86FD74:\n"
+                "MOV     R0, #0\n"
+                "B       loc_FF86FE08\n"
+"loc_FF86FD7C:\n"
+                "MOV     R0, R7\n"
+                "BL      sub_FF88034C\n"
+                "MOV     R1, R0\n"
+                "ADD     R2, SP, #4\n"
+                "MOV     R3, SP\n"
+                "MOV     R0, R6\n"
+
+                "STMFD   SP!, {R4-R11,LR}\n" // +
+                "BL      mbr_read\n"    //-----------> 
+                "LDMFD   SP!, {R4-R11,LR}\n" // +
+
+          //    "BL      sub_FF86F494\n"   // original function
+                "MOV     R4, R0\n"
+                "MOV     R0, #3\n"
+                "BL      sub_FF8128FC\n"
+                "CMP     R4, #0\n"
+                "BNE     loc_FF86FDE0\n"
+                "MOV     R0, R7\n"
+                "STR     R4, [SP,#4]\n"
+                "BL      sub_FF88034C\n"
+                "STR     R0, [SP]\n"
+                "B       loc_FF86FDE0\n"
+"loc_FF86FDC0:\n"
+                "MOV     R3, #0\n"
+                "MOV     R2, #0x40\n"
+                "STMEA   SP, {R2,R3}\n"
+                "B       loc_FF86FDE0\n"
+"loc_FF86FDD0:\n"
+                "MOV     R1, #0x28C\n"
+                "LDR     R0, =0xFF86FAA0\n"
+                "ADD     R1, R1, #1\n"
+                "BL      sub_FF813B80\n"
+"loc_FF86FDE0:\n"
+                "LDR     R2, =0x2BFF8\n"
+                "ADD     R3, R8, R5\n"
+                "LDMFD   SP, {R0,R12}\n"
+                "RSB     R3, R5, R3,LSL#3\n"
+                "MOV     R3, R3,LSL#2\n"
+                "ADD     R1, R2, #0x48\n"
+                "ADD     R2, R2, #0x44\n"
+                "STR     R0, [R1,R3]\n"
+                "STR     R12, [R2,R3]\n"
+                "MOV     R0, #1\n"
+"loc_FF86FE08:\n"
+                "ADD     SP, SP, #8\n"
+                "LDMFD   SP!, {R4-R8,PC}\n"
+ );
+}
Index: /trunk/platform/s3is/sub/100a/stubs_entry_2.S
===================================================================
--- /trunk/platform/s3is/sub/100a/stubs_entry_2.S	(revision 511)
+++ /trunk/platform/s3is/sub/100a/stubs_entry_2.S	(revision 511)
@@ -0,0 +1,29 @@
+#include "stubs_asm.h"
+
+NHSTUB(VbattGet, 0xFF82C328)
+NHSTUB(GetZoomLensCurrentPosition, 0xFFAE8474)
+NHSTUB(GetZoomLensCurrentPoint, 0xFFAE8460)
+NHSTUB(MoveZoomLensWithPoint, 0xFFAE8280)
+NHSTUB(SetZoomActuatorSpeedPercent, 0xFFAE83F8)
+//NHSTUB(GetFocusLensSubjectDistance, 0xFFEA2F3C)
+
+NHSTUB(platformsub_kbd_fetch_data, 0xFF8281C4)
+NHSTUB(kbd_read_keys_r2, 0xFF827BC0)
+
+NHSTUB(free, 0xFFB571E4)
+NHSTUB(malloc, 0xFFB571D8)
+
+NHSTUB(UniqueLedOn, 0xFF82DC3C)
+NHSTUB(UniqueLedOff, 0xFF82DCA0)
+
+NHSTUB(GetDrive_ClusterSize, 0xFF870710)
+NHSTUB(GetDrive_TotalClusters, 0xFF87076C)
+NHSTUB(GetDrive_FreeClusters, 0xFF8707A8)
+NHSTUB(WriteSDCard, 0xFF87FFF8)
+NHSTUB(UnsetZoomForMovie, 0xFF8117EC)  //null stub
+NHSTUB(GetBatteryTemperature, 0xFF82D37C)
+NHSTUB(GetCCDTemperature, 0xFF82D368)
+NHSTUB(GetOpticalTemperature, 0xFF82D354)
+NHSTUB(PT_PlaySound, 0xFF986518)
+NHSTUB(EnterToCompensationEVF, 0xff978b78)
+NHSTUB(ExitFromCompensationEVF, 0xff978bd8)
Index: /trunk/platform/s3is/sub/100a/boot.c
===================================================================
--- /trunk/platform/s3is/sub/100a/boot.c	(revision 511)
+++ /trunk/platform/s3is/sub/100a/boot.c	(revision 511)
@@ -0,0 +1,167 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+const long new_sa = MEMISOSTART + MEMISOSIZE;
+
+/* Ours stuff */
+extern long wrs_kernel_bss_start;
+extern long wrs_kernel_bss_end;
+extern void createHook (void *pNewTcb);
+extern void deleteHook (void *pTcb);
+
+
+void boot();
+
+/* "relocated" functions */
+void __attribute__((naked,noinline)) h_usrInit();
+void __attribute__((naked,noinline)) h_usrKernelInit();
+void __attribute__((naked,noinline)) h_usrRoot();
+
+
+
+void boot()
+{
+    long *canon_data_src = (void*)0xFFB6B240;
+    long *canon_data_dst = (void*)0x1900;
+    long canon_data_len = 0xC890;
+    long *canon_bss_start = (void*)0xe190; // just after data
+    long canon_bss_len = 0x96410 - 0xe190;
+    long i;
+
+    asm volatile (
+	"MRC     p15, 0, R0,c1,c0\n"
+	"ORR     R0, R0, #0x1000\n"
+	"ORR     R0, R0, #4\n"
+	"ORR     R0, R0, #1\n"
+	"MCR     p15, 0, R0,c1,c0\n"
+    :::"r0");
+
+    for(i=0;i<canon_data_len/4;i++)
+	canon_data_dst[i]=canon_data_src[i];
+
+    for(i=0;i<canon_bss_len/4;i++)
+	canon_bss_start[i]=0;
+
+    asm volatile (
+	"MRC     p15, 0, R0,c1,c0\n"
+	"ORR     R0, R0, #0x1000\n"
+	"BIC     R0, R0, #4\n"
+	"ORR     R0, R0, #1\n"
+	"MCR     p15, 0, R0,c1,c0\n"
+    :::"r0");
+
+    h_usrInit();
+}
+
+
+void h_usrInit()
+{
+    asm volatile (
+	"STR     LR, [SP,#-4]!\n"
+	"BL      sub_FF81196C\n"
+	"MOV     R0, #2\n"
+	"MOV     R1, R0\n"
+	"BL      sub_FFB50BA0\n"
+	"BL      sub_FFB43814\n"
+	"BL      sub_FF8111C4\n"
+	"BL      sub_FF81172C\n"
+	"LDR     LR, [SP],#4\n"
+	"B       h_usrKernelInit\n"
+    );
+}
+
+void  h_usrKernelInit()
+{
+    asm volatile (
+	"STMFD   SP!, {R4,LR}\n"
+	"SUB     SP, SP, #8\n"
+	"BL      sub_FFB510A0\n"
+	"BL      sub_FFB648A8\n"
+	"LDR     R3, =0xD1A8\n"
+	"LDR     R2, =0x92240\n"
+	"LDR     R1, [R3]\n"
+	"LDR     R0, =0x95DD0\n"
+	"MOV     R3, #0x100\n"
+	"BL      sub_FFB5D9B8\n"
+	"LDR     R3, =0xD168\n"
+	"LDR     R0, =0xD9B0\n"
+	"LDR     R1, [R3]\n"
+	"BL      sub_FFB5D9B8\n"
+	"LDR     R3, =0xD224\n"
+	"LDR     R0, =0x95DA4\n"
+	"LDR     R1, [R3]\n"
+	"BL      sub_FFB5D9B8\n"
+	"BL      sub_FFB69428\n"
+	"BL      sub_FF8112B0\n"
+	"MOV     R4, #0\n"
+	"MOV     R3, R0\n"
+	"MOV     R12, #0x800\n"
+	"LDR     R0, =h_usrRoot\n"
+	"MOV     R1, #0x4000\n"
+    );    
+//	"LDR     R2, =0xD6410\n"	// 0x96410 + 0x40000
+    asm volatile (
+        "LDR     R2, =new_sa\n"
+        "LDR     R2, [R2]\n"
+    );
+    asm volatile (
+	"STR     R12, [SP]\n"
+	"STR     R4, [SP,#4]\n"
+	"BL      sub_FFB61AE8\n"
+	"ADD     SP, SP, #8\n"
+	"LDMFD   SP!, {R4,PC}\n"
+    );
+}
+
+static long drv_struct[16];
+ 
+static long dh_err()
+{
+    return -1;
+}
+
+static void drv_self_hide()
+{
+    long drvnum;
+    
+    drvnum = _iosDrvInstall(dh_err,dh_err,dh_err,dh_err,dh_err,dh_err,dh_err);
+    if (drvnum >= 0)
+	_iosDevAdd(drv_struct, "A/DISKBOOT.BIN", drvnum);
+}
+
+
+void  h_usrRoot()
+{
+    asm volatile (
+	"STMFD   SP!, {R4,R5,LR}\n"
+	"MOV     R5, R0\n"
+	"MOV     R4, R1\n"
+	"BL      sub_FF8119D4\n"
+	"MOV     R1, R4\n"
+	"MOV     R0, R5\n"
+	"BL      sub_FFB55D34\n"
+	"MOV     R1, R4\n"
+	"MOV     R0, R5\n"
+	"BL      sub_FFB567AC\n"
+	"BL      sub_FF811708\n"
+	"MOV     R0, #0x32\n"
+	"BL      sub_FFB58750\n"
+	"BL      sub_FF811A14\n"
+	"BL      sub_FF8119F8\n"
+	"BL      sub_FF811A40\n"
+	"BL      sub_FFB58010\n"
+	"BL      sub_FF8119C8\n"
+    );
+
+    _taskCreateHookAdd(createHook);
+    _taskDeleteHookAdd(deleteHook);
+
+    drv_self_hide();
+
+    asm volatile (
+	"LDMFD   SP!, {R4,R5,LR}\n"
+	"B       sub_FF811370\n"
+    );
+}
+
Index: /trunk/platform/s3is/sub/100a/stubs_min.S
===================================================================
--- /trunk/platform/s3is/sub/100a/stubs_min.S	(revision 511)
+++ /trunk/platform/s3is/sub/100a/stubs_min.S	(revision 511)
@@ -0,0 +1,13 @@
+#include "stubs_asm.h"
+
+DEF(physw_status, 0xF218)
+DEF(physw_run, 0x1FB0)
+DEF(playrec_mode, 0x6924)
+DEF(led_table, 0xF4F8)
+DEF(zoom_busy, 0x6C880)
+DEF(focus_busy, 0x6CA04)
+DEF(FlashParamsTable,0xFF991894)
+DEF(canon_menu_active,0x8AEC)
+DEF(canon_shoot_menu_active,0x7DA5)
+DEF(recreview_hold, 0x69480)
+DEF(movie_status,0x6115C)
Index: /trunk/platform/s3is/sub/100a/makefile.inc
===================================================================
--- /trunk/platform/s3is/sub/100a/makefile.inc	(revision 511)
+++ /trunk/platform/s3is/sub/100a/makefile.inc	(revision 511)
@@ -0,0 +1,14 @@
+PLATFORMID=12570
+
+PLATFORMOS=vxworks
+
+MEMBASEADDR=0x1900
+RESTARTSTART=0x50000
+MEMISOSTART=0x96410
+MEMISOSIZE=0x55000
+ROMBASEADDR=0xff810000
+
+TARGET_PRIMARY=$(topdir)platform/$(PLATFORM)/sub/$(PLATFORMSUB)/PRIMARY.BIN
+
+PLFLAGS=-DMEMBASEADDR=$(MEMBASEADDR) -DMEMISOSTART=$(MEMISOSTART) -DMEMISOSIZE=$(MEMISOSIZE)
+PLFLAGS+=-DRESTARTSTART=$(RESTARTSTART)
Index: /trunk/platform/s3is/sub/100a/stubs_asm.h
===================================================================
--- /trunk/platform/s3is/sub/100a/stubs_asm.h	(revision 511)
+++ /trunk/platform/s3is/sub/100a/stubs_asm.h	(revision 511)
@@ -0,0 +1,20 @@
+    .text
+
+#define DEF(n,a) \
+    .globl n; n = a
+
+#define NSTUB(name, addr)\
+    .globl _##name ;\
+    .weak _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define NHSTUB(name, addr)\
+    .globl _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define STUB(addr)\
+    .globl sub_ ## addr ;\
+    sub_ ## addr: ;\
+	ldr  pc, =0x ## addr
Index: /trunk/platform/s3is/sub/100a/lib.c
===================================================================
--- /trunk/platform/s3is/sub/100a/lib.c	(revision 511)
+++ /trunk/platform/s3is/sub/100a/lib.c	(revision 511)
@@ -0,0 +1,73 @@
+#include "platform.h"
+
+void *hook_raw_fptr()
+{
+    return (void*)0x345B8;
+}
+
+void *hook_raw_ret_addr()
+{
+    return (void*)0xFF8D4788;
+}
+
+char *hook_raw_image_addr()
+{
+    return (char*)(0x105B8AC0);
+}
+
+long hook_raw_size()
+{
+    return 0x75A8F0;
+}
+
+void *vid_get_viewport_live_fb()
+{
+//    return (void*)0;
+    void **fb=(void **)0x54e8;
+    unsigned char buff = *((unsigned char*)0x54f8);
+    if (buff == 0) {
+        buff = 2;
+    }
+    else {
+        buff--;
+    }
+    return fb[buff];
+}
+
+void *vid_get_bitmap_fb()
+{
+    return (void*)0x103C79A0;
+}
+
+void *vid_get_viewport_fb()
+{
+    return (void*)0x105f17a0; //0x105599A0;
+}
+
+void *vid_get_viewport_fb_d()
+{
+    return (void*)(*(int*)0x60134);
+}
+
+long vid_get_bitmap_screen_width()
+{
+    return 360;
+}
+
+long vid_get_bitmap_screen_height()
+{
+    return 240;
+}
+
+long vid_get_viewport_height()
+{
+    return 240;
+}
+char *camera_jpeg_count_str()
+{
+    return (char*)0x6BC28;
+}
+
+long vid_get_bitmap_buffer_width() { return 360; }
+
+long vid_get_bitmap_buffer_height() { return 240; }
Index: /trunk/platform/s3is/sub/100a/movie_rec.c
===================================================================
--- /trunk/platform/s3is/sub/100a/movie_rec.c	(revision 511)
+++ /trunk/platform/s3is/sub/100a/movie_rec.c	(revision 511)
@@ -0,0 +1,751 @@
+#include "conf.h"
+
+int *video_quality = &conf.video_quality;
+int *video_mode    = &conf.video_mode;
+
+long def_table1[42]={
+0x2000, 0x38D, 0x788, 0xBE1, 0x10CB,0x1642,0x1C48,0x22F9, 0x2A79, 0x32AA, 0x3C01, 0x4637, 0x5190, 0x5E0E,
+0x5800, 0x9C5, 0x14B8,0x20C9,0x2E31,0x3D39,0x4DC9,0x6030, 0x74D1, 0x8B8D, 0xA509, 0xC160, 0xE054, 0x102AF,
+0x10000,0x1C6A,0x3C45,0x5F60,0x8661,0xB21A,0xE249,0x117D2,0x153D5,0x195F8,0x1E01C,0x2328E,0x28C99,0x2F08B
+};
+
+long def_table2[9]={0x1CCD,-0x2E1,-0x579,0x4F33,-0x7EB,-0xF0C,0xE666,-0x170A,-0x2BC6};
+
+long table1[42], table2[9];
+
+void change_video_tables(int a, int b){
+ int i;
+ for (i=0;i<42;i++) table1[i]=(def_table1[i]*a)/b;
+ for (i=0;i<9; i++) table2[i]=(def_table2[i]*a)/b;
+}
+
+long CompressionRateTable[]={0x60, 0x5D, 0x5A, 0x57, 0x54, 0x51, 0x4D, 0x48, 0x42, 0x3B, 0x32, 0x29, 0x22, 0x1D, 0x17, 0x14, 0x10, 0xE, 0xB, 9, 7, 6, 5, 4, 3, 2, 1};
+
+
+void __attribute__((naked,noinline)) movie_record_task(){
+ asm volatile(
+                "STMFD   SP!, {R4,LR}\n"    
+                "SUB     SP, SP, #4\n"      
+                "MOV     R4, SP\n"          
+                "B       loc_FF963204\n"    
+"loc_FF96313C:\n"                           
+                "LDR     R3, =0x61140\n"    
+                "LDR     R2, [R3]\n"        
+                "CMP     R2, #0\n"          
+                "BNE     loc_FF9631CC\n"    
+                "SUB     R3, R12, #2\n"     
+                "CMP     R3, #9\n"          
+                "LDRLS   PC, [PC,R3,LSL#2]\n" 
+                "B       loc_FF9631CC\n"    
+                ".long loc_FF96318C\n"
+                ".long loc_FF9631A4\n"
+                ".long loc_FF9631AC\n"
+                ".long loc_FF9631B4\n"
+                ".long loc_FF963194\n"
+                ".long loc_FF9631BC\n"
+                ".long loc_FF96319C\n"
+                ".long loc_FF9631CC\n"
+                ".long loc_FF9631C4\n"
+                ".long loc_FF963184\n"
+"loc_FF963184:\n"                           
+                                        
+                "BL      sub_FF9632B0\n"    
+                "B       loc_FF9631C8\n"    
+"loc_FF96318C:\n"                           
+                                        
+                "BL      sub_FF9634C0\n"    
+                "B       loc_FF9631C8\n"    
+"loc_FF963194:\n"                           
+                                        
+                "BL      sub_FF96396C_my\n"    //-------------->
+                "B       loc_FF9631C8\n"    
+"loc_FF96319C:\n"                           
+                                        
+                "BL      sub_FF963DA0\n"    
+                "B       loc_FF9631C8\n"    
+"loc_FF9631A4:\n"                           
+                                        
+                "BL      sub_FF963C04\n"    
+                "B       loc_FF9631C8\n"    
+"loc_FF9631AC:\n"                           
+                                        
+                "BL      sub_FF964018\n"    
+                "B       loc_FF9631C8\n"    
+"loc_FF9631B4:\n"                           
+                                        
+                "BL      sub_FF9641DC\n"    
+                "B       loc_FF9631C8\n"    
+"loc_FF9631BC:\n"                           
+                                        
+                "BL      sub_FF963F30\n"    
+                "B       loc_FF9631C8\n"    
+"loc_FF9631C4:\n"                           
+                                        
+                "BL      sub_FF963C54\n"    
+"loc_FF9631C8:\n"                           
+                                        
+                "LDR     R1, [SP]\n"        
+"loc_FF9631CC:\n"                           
+                                        
+                "LDR     R3, [R1]\n"        
+                "CMP     R3, #9\n"          
+                "BNE     loc_FF9631E4\n"    
+                "MOV     R0, R1\n"          
+                "BL      sub_FF964370\n" 
+                "LDR     R1, [SP]\n"        
+"loc_FF9631E4:\n"                           
+                "LDR     R3, =0x61074\n"    
+                "MOV     R2, #0\n"          
+                "LDR     R0, [R3]\n"        
+                "STR     R2, [R1]\n"        
+                "BL      sub_FF8208D4\n" 
+                "LDR     R3, =0x61220\n"    
+                "LDR     R0, [R3]\n"        
+                "BL      sub_FF821250\n"   
+"loc_FF963204:\n"                           
+                "LDR     R3, =0x61070\n"    
+                "MOV     R1, R4\n"          
+                "LDR     R0, [R3]\n"        
+                "MOV     R2, #0\n"          
+                "BL      sub_FF8204BC\n" 
+                "LDR     R3, =0x61220\n"    
+                "MOV     R1, #0\n"          
+                "LDR     R0, [R3]\n"        
+                "BL      sub_FF821068\n"   
+                "LDR     R0, [SP]\n"        
+                "LDR     R12, [R0]\n"       
+                "CMP     R12, #0xC\n"       
+                "MOV     R1, R0\n"          
+                "BNE     loc_FF96313C\n"    
+                "LDR     R3, =0x6106C\n"    
+                "LDR     R0, [R3]\n"        
+                "BL      sub_FF821250\n"   
+                "BL      sub_FF821A18\n"        
+                "ADD     SP, SP, #4\n"      
+                "LDMFD   SP!, {R4,PC}\n"    
+ );
+}
+
+void __attribute__((naked,noinline)) sub_FF96396C_my(){
+ asm volatile(
+                "STMFD   SP!, {R4-R11,LR}\n" 
+                "LDR     R5, =0x6115C\n"    
+                "SUB     SP, SP, #0x34\n"   
+                "LDR     R3, [R5]\n"        
+                "CMP     R3, #3\n"          
+                "MOV     R4, R0\n"          
+                "MOVEQ   R3, #4\n"          
+                "STREQ   R3, [R5]\n"        
+                "LDR     R3, =0x6120C\n"    
+                "MOV     LR, PC\n"          
+                "LDR     PC, [R3]\n"        
+                "LDR     R2, [R5]\n"        
+                "CMP     R2, #4\n"          
+                "BNE     loc_FF963B30\n"    
+                "ADD     R0, SP, #0x30\n"   
+                "ADD     R1, SP, #0x2C\n"   
+                "ADD     R2, SP, #0x28\n"   
+                "ADD     R3, SP, #0x24\n"   
+                "BL      sub_FF965910_my\n"       // -------------------->
+                "CMP     R0, #0\n"          
+                "BNE     loc_FF9639E8\n"    
+                "LDR     R3, =0x61148\n"    
+                "LDR     R2, [R3]\n"        
+                "CMP     R2, #1\n"          
+                "BNE     loc_FF9639FC\n"    
+                "LDR     R2, =0x611A0\n"    
+                "LDR     R1, =0x61174\n"    
+                "LDR     R12, [R2]\n"       
+                "LDR     R3, [R1]\n"        
+                "CMP     R12, R3\n"         
+                "BCC     loc_FF9639FC\n"    
+"loc_FF9639E8:\n"                           
+                "BL      sub_FF963B7C\n"    
+                "BL      sub_FF963D7C\n"    
+                "MOV     R3, #5\n"          
+                "STR     R3, [R5]\n"        
+                "B       loc_FF963B30\n"    
+"loc_FF9639FC:\n"                           
+                                        
+                "LDR     R12, =0x611A8\n"   
+                "LDR     R11, =0x611B4\n"   
+                "LDMIB   R4, {R0-R2}\n"     
+                "LDR     R10, [R12]\n"      
+                "LDR     R7, [R11]\n"       
+                "LDR     R4, [SP,#0x2C]\n"  
+                "LDR     R5, [SP,#0x28]\n"  
+                "LDR     R6, [SP,#0x24]\n"  
+                "LDR     R8, =0x6114C\n"    
+                "LDR     R3, [SP,#0x30]\n"  
+                "ADD     R12, SP, #0x20\n"  
+                "ADD     LR, SP, #0x1C\n"   
+                "MOV     R9, #1\n"          
+                "STMEA   SP, {R4-R6,R12}\n" 
+                "STR     R10, [SP,#0x10]\n" 
+                "STR     R7, [SP,#0x14]\n"  
+                "STR     LR, [SP,#0x18]\n"  
+                "STR     R9, [R8]\n"        
+                "BL      sub_FF8984C8\n"    
+                "LDR     R3, =0x61064\n"    
+                "MOV     R1, #0x3E8\n"      
+                "LDR     R0, [R3]\n"        
+                "BL      sub_FF821068\n"   
+                "CMP     R0, #9\n"          
+                "BNE     loc_FF963A70\n"    
+                "BL      sub_FF966184\n"    
+                "LDR     R3, =0x6115C\n"    
+                "LDR     R0, =0xFF963954\n" 
+                "B       loc_FF963A88\n"    
+"loc_FF963A70:\n"                           
+                "LDR     R5, [SP,#0x1C]\n"  
+                "CMP     R5, #0\n"          
+                "BEQ     loc_FF963A94\n"    
+                "BL      sub_FF966184\n"    
+                "LDR     R3, =0x6115C\n"    
+                "LDR     R0, =0xFF963960\n" 
+"loc_FF963A88:\n"                           
+                "STR     R9, [R3]\n"        
+                "BL      sub_FF986B94\n"    
+                "B       loc_FF963B30\n"    
+"loc_FF963A94:\n"                           
+                "BL      sub_FF898634\n"    
+                "LDR     R0, [SP,#0x30]\n"  
+                "LDR     R1, [SP,#0x20]\n"  
+                "BL      sub_FF965E94\n"    
+                "LDR     R4, =0x611A0\n"    
+                "LDR     R3, [R4]\n"        
+                "ADD     R3, R3, #1\n"      
+                "LDR     R0, [SP,#0x20]\n"  
+                "MOV     R1, R11\n"         
+                "STR     R3, [R4]\n"        
+                "MOV     R2, R5\n"          
+                "BL      sub_FF964B98_my\n"   //----------------->
+                "LDR     R3, =0x611C0\n"    
+                "LDR     R1, [R4]\n"        
+                "LDR     R2, [R3]\n"        
+                "LDR     R12, =0x611BC\n"   
+                "MUL     R0, R2, R1\n"      
+                "LDR     R1, [R12]\n"       
+                "BL      sub_FFB4AF3C\n"       
+                "LDR     R7, =0x611B8\n"    
+                "LDR     R3, [R7]\n"        
+                "MOV     R4, R0\n"          
+                "CMP     R3, R4\n"          
+                "BNE     loc_FF963B08\n"    
+                "LDR     R6, =0x61150\n"    
+                "LDR     R3, [R6]\n"        
+                "CMP     R3, #1\n"          
+                "BNE     loc_FF963B24\n"    
+                "B       loc_FF963B0C\n"    
+"loc_FF963B08:\n"                           
+                "LDR     R6, =0x61150\n"    
+"loc_FF963B0C:\n"                           
+                "LDR     R3, =0x611F0\n"    
+                "MOV     R0, R4\n"          
+                "MOV     LR, PC\n"          
+                "LDR     PC, [R3]\n"        
+                "STR     R5, [R6]\n"        
+                "STR     R4, [R7]\n"        
+"loc_FF963B24:\n"                           
+                "LDR     R2, =0x6114C\n"    
+                "MOV     R3, #0\n"          
+                "STR     R3, [R2]\n"        
+"loc_FF963B30:\n"                           
+                "ADD     SP, SP, #0x34\n"   
+                "LDMFD   SP!, {R4-R11,PC}\n" 
+ );
+}
+
+
+
+void __attribute__((naked,noinline)) sub_FF965910_my(){
+ asm volatile(
+                "STMFD   SP!, {R4-R11,LR}\n" 
+                "LDR     R5, =0x61518\n"    
+                "SUB     SP, SP, #0x14\n"   
+                "LDR     LR, [R5]\n"        
+                "LDR     R12, =0x61530\n"   
+                "ADD     LR, LR, #1\n"      
+                "LDR     R4, [R12]\n"       
+                "STR     LR, [R5]\n"        
+                "LDR     R12, =0x615B4\n"   
+                "STR     R0, [SP,#0x10]\n"  
+                "STR     R1, [SP,#0xC]\n"   
+                "STR     R2, [SP,#8]\n"     
+                "STR     R3, [SP,#4]\n"     
+                "CMP     LR, R4\n"          
+                "LDR     R11, [R12]\n"      
+                "MOVHI   R0, #0x80000001\n" 
+                "BHI     loc_FF965E40\n"    
+                "LDR     R3, =0x61598\n"    
+                "MOV     R0, LR\n"          
+                "LDR     R1, [R3]\n"        
+                "BL      sub_FFB4B5CC\n"       
+                "CMP     R0, #1\n"          
+                "BNE     loc_FF965B40\n"    
+                "LDR     R0, =0x615BC\n"    
+                "LDR     R1, =0x61500\n"    
+                "LDR     R3, [R0]\n"        
+                "LDR     R2, [R1]\n"        
+                "CMP     R3, R2\n"          
+                "LDREQ   R3, =0x615B8\n"    
+                "LDREQ   R5, [R3]\n"        
+                "MOVNE   R5, R2\n"          
+                "LDR     R3, =0x61518\n"    
+                "LDR     R2, =0x61598\n"    
+                "LDR     R0, [R3]\n"        
+                "LDR     R1, [R2]\n"        
+                "BL      sub_FFB4AF3C\n"       
+                "LDR     R2, =0xAAAAAAAB\n" 
+                "ADD     R0, R0, #1\n"      
+                "UMULL   R1, R3, R2, R0\n"  
+                "MOV     R3, R3,LSR#1\n"    
+                "ADD     R3, R3, R3,LSL#1\n" 
+                "LDR     R2, =0x61508\n"    
+                "RSB     R0, R3, R0\n"      
+                "STR     R5, [R2,R0,LSL#2]\n" 
+                "LDR     R3, =0x614FC\n"    
+                "LDR     R2, [R3]\n"        
+                "CMP     R5, R2\n"          
+                "BHI     loc_FF9659F0\n"    
+                "LDR     R4, =0x61550\n"    
+                "LDR     R3, [R4]\n"        
+                "ADD     R3, R5, R3\n"      
+                "ADD     R3, R3, #8\n"      
+                "CMP     R2, R3\n"          
+                "BCS     loc_FF9659F4\n"    
+"loc_FF9659E8:\n"                           
+                                        
+                "MOV     R0, #0x80000003\n" 
+                "B       loc_FF965E40\n"    
+"loc_FF9659F0:\n"                           
+                "LDR     R4, =0x61550\n"    
+"loc_FF9659F4:\n"                           
+                "LDR     R3, [R4]\n"        
+                "LDR     R2, =0x615BC\n"    
+                "ADD     R1, R5, R3\n"      
+                "LDR     R3, [R2]\n"        
+                "ADD     R2, R1, #8\n"      
+                "CMP     R2, R3\n"          
+                "BLS     loc_FF965A40\n"    
+                "LDR     R2, =0x615B8\n"    
+                "LDR     R0, =0x614FC\n"    
+                "RSB     R3, R3, R1\n"      
+                "LDR     R1, [R2]\n"        
+                "ADD     R3, R3, #8\n"      
+                "LDR     R2, [R0]\n"        
+                "ADD     R1, R1, R3\n"      
+                "CMP     R2, R1\n"          
+                "BCC     loc_FF9659E8\n"    
+                "LDR     R3, =0x61500\n"    
+                "STR     R1, [R3]\n"        
+                "B       loc_FF965A48\n"    
+"loc_FF965A40:\n"                           
+                "LDR     R3, =0x61500\n"    
+                "STR     R2, [R3]\n"        
+"loc_FF965A48:\n"                           
+                "LDR     R3, [R4]\n"        
+                "LDR     R12, =0x61568\n"   
+                "ADD     R3, R3, #0x18\n"   
+                "LDR     R2, [R12,#4]\n"    
+                "MOV     R0, R3\n"          
+                "MOV     R1, #0\n"          
+                "CMP     R1, R2\n"          
+                "BHI     loc_FF965C8C\n"    
+                "BNE     loc_FF965A78\n"    
+                "LDR     R3, [R12]\n"       
+                "CMP     R0, R3\n"          
+                "BHI     loc_FF965C8C\n"    
+"loc_FF965A78:\n"                           
+                "LDR     R4, [R4]\n"        
+                "LDR     LR, =0x61570\n"    
+                "STR     R4, [SP]\n"        
+                "LDR     R12, =0x61568\n"   
+                "LDR     R3, =0x61518\n"    
+                "LDMIA   LR, {R7,R8}\n"     
+                "LDMIA   R12, {R5,R6}\n"    
+                "LDR     R10, [R3]\n"       
+                "LDR     R2, =0x61598\n"    
+                "MOV     R3, R4\n"          
+                "MOV     R4, #0\n"          
+                "ADDS    R7, R7, R3\n"      
+                "ADC     R8, R8, R4\n"      
+                "LDR     R9, [R2]\n"        
+                "SUBS    R5, R5, R3\n"      
+                "SBC     R6, R6, R4\n"      
+                "MVN     R2, #0\n"          
+                "MVN     R1, #0x17\n"       
+                "ADDS    R5, R5, R1\n"      
+                "MOV     R4, #0\n"          
+                "MOV     R3, #0x18\n"       
+                "ADC     R6, R6, R2\n"      
+                "ADDS    R7, R7, R3\n"      
+                "ADC     R8, R8, R4\n"      
+                "STMIA   R12, {R5,R6}\n"    
+                "SUB     R0, R10, #1\n"     
+                "MOV     R1, R9\n"          
+                "STMIA   LR, {R7,R8}\n"     
+                "BL      sub_FFB4AF3C\n"       
+                "CMP     R10, #1\n"         
+                "MLA     R0, R9, R0, R0\n"  
+                "BEQ     loc_FF965B40\n"    
+                "SUB     R3, R0, #1\n"      
+                "MOV     R3, R3,LSL#4\n"    
+                "ADD     R4, R11, #0x10\n"  
+                "ADD     R5, R11, #0x14\n"  
+                "LDR     R1, [R5,R3]\n"     
+                "LDR     R2, [R4,R3]\n"     
+                "LDR     LR, =0x62773130\n" 
+                "ADD     R2, R2, R1\n"      
+                "MOV     R3, R0,LSL#4\n"    
+                "ADD     R2, R2, #8\n"      
+                "MOV     R0, #0\n"          
+                "ADD     R12, R11, #0xC\n"  
+                "ADD     R1, R11, #8\n"     
+                "STR     LR, [R1,R3]\n"     
+                "STR     R0, [R12,R3]\n"    
+                "STR     R2, [R4,R3]\n"     
+                "LDR     R0, [SP]\n"        
+                "STR     R0, [R5,R3]\n"     
+"loc_FF965B40:\n"                           
+                                        
+                "LDR     R2, =0x61500\n"    
+                "LDR     R3, =0x615BC\n"    
+                "LDR     R1, [R2]\n"        
+                "LDR     R0, [R3]\n"        
+                "ADD     R3, R1, #9\n"      
+                "CMP     R3, R0\n"          
+                "BLS     loc_FF965B7C\n"    
+                "LDR     R2, =0x615B8\n"    
+                "LDR     R3, [R2]\n"        
+                "ADD     R3, R3, R1\n"      
+                "RSB     R3, R0, R3\n"      
+                "LDR     R0, [SP,#0x10]\n"  
+                "ADD     R3, R3, #8\n"      
+                "STR     R3, [R0]\n"        
+                "B       loc_FF965B88\n"    
+"loc_FF965B7C:\n"                           
+                "ADD     R3, R1, #8\n"      
+                "LDR     R1, [SP,#0x10]\n"  
+                "STR     R3, [R1]\n"        
+"loc_FF965B88:\n"                           
+                "LDR     R2, [SP,#0x10]\n"  
+                "LDR     R1, =0x61560\n"    
+                "LDR     R3, =0x615BC\n"    
+                "LDR     R12, [R2]\n"       
+                "LDR     R2, [R1]\n"        
+                "LDR     R0, [R3]\n"        
+                "ADD     R3, R12, R2\n"     
+                "CMP     R3, R0\n"          
+                "BLS     loc_FF965BDC\n"    
+                "LDR     R2, [SP,#0xC]\n"   
+                "RSB     R0, R12, R0\n"     
+                "STR     R0, [R2]\n"        
+                "LDR     R2, =0x615B8\n"    
+                "LDR     R3, [R1]\n"        
+                "LDR     R1, [R2]\n"        
+                "RSB     R3, R0, R3\n"      
+                "LDR     R0, [SP,#8]\n"     
+                "STR     R1, [R0]\n"        
+                "LDR     R1, [SP,#4]\n"     
+                "STR     R3, [R1]\n"        
+                "B       loc_FF965BF8\n"    
+"loc_FF965BDC:\n"                           
+                "LDR     R0, [SP,#0xC]\n"   
+                "STR     R2, [R0]\n"        
+                "LDR     R1, [SP,#4]\n"     
+                "MOV     R3, #0\n"          
+                "STR     R3, [R1]\n"        
+                "LDR     R2, [SP,#8]\n"     
+                "STR     R3, [R2]\n"        
+"loc_FF965BF8:\n"                           
+                "LDR     R0, =0x61500\n"    
+                "LDR     R1, =0x614FC\n"    
+                "LDR     R3, [R0]\n"        
+                "LDR     R2, [R1]\n"        
+                "CMP     R3, R2\n"          
+                "BHI     loc_FF965C24\n"    
+                "LDR     R0, [SP,#0xC]\n"   
+                "LDR     R3, [R0]\n"        
+                "ADD     R3, R12, R3\n"     
+                "CMP     R2, R3\n"          
+                "BCC     loc_FF9659E8\n"    
+"loc_FF965C24:\n"                           
+                "LDR     R1, [SP,#8]\n"     
+                "LDR     R2, [R1]\n"        
+                "CMP     R2, #0\n"          
+                "BEQ     loc_FF965C58\n"    
+                "LDR     R3, =0x614FC\n"    
+                "LDR     R1, [R3]\n"        
+                "CMP     R2, R1\n"          
+                "BHI     loc_FF965C58\n"    
+                "LDR     R0, [SP,#4]\n"     
+                "LDR     R3, [R0]\n"        
+                "ADD     R3, R2, R3\n"      
+                "CMP     R1, R3\n"          
+                "BCC     loc_FF9659E8\n"    
+"loc_FF965C58:\n"                           
+                                        
+                "LDR     R3, =0x61560\n"    
+                "LDR     R0, =0x61568\n"    
+                "LDR     R2, [R3]\n"        
+                "LDR     R3, [R0,#4]\n"     
+                "ADD     R2, R2, #0x18\n"   
+                "MOV     R1, R2\n"          
+                "MOV     R2, #0\n"          
+                "CMP     R2, R3\n"          
+                "BHI     loc_FF965C8C\n"    
+                "BNE     loc_FF965C94\n"    
+                "LDR     R3, [R0]\n"        
+                "CMP     R1, R3\n"          
+                "BLS     loc_FF965C94\n"    
+"loc_FF965C8C:\n"                           
+                                        
+                "MOV     R0, #0x80000005\n" 
+                "B       loc_FF965E40\n"    
+"loc_FF965C94:\n"                           
+                                        
+                "LDR     R1, =0x61548\n"    
+                "LDR     R0, =0x61598\n"    
+                "LDR     R3, [R1]\n"        
+                "LDR     R2, [R0]\n"        
+                "ADD     R3, R3, R2,LSL#4\n" 
+                "ADD     R3, R3, R3,LSL#2\n" 
+                "LDR     R12, =0x61568\n"   
+                "MOV     R3, R3,LSL#1\n"    
+                "ADD     R3, R3, #0xA0\n"   
+                "LDR     R2, [R12,#4]\n"    
+                "MOV     R0, R3\n"          
+                "MOV     R1, #0\n"          
+                "CMP     R1, R2\n"          
+                "BHI     loc_FF965CDC\n"    
+                "BNE     loc_FF965D00\n"    
+                "LDR     R3, [R12]\n"       
+                "CMP     R0, R3\n"          
+                "BLS     loc_FF965D00\n"    
+"loc_FF965CDC:\n"                           
+                "LDR     R4, =0x61580\n"    
+                "LDR     R1, [R4]\n"        
+                "CMP     R1, #0\n"          
+                "BNE     loc_FF965D00\n"    
+                "MOV     R0, #0x3140\n"     
+                "ADD     R0, R0, #8\n"      
+                "BL      sub_FF98B0C4\n"    
+                "MOV     R3, #1\n"          
+                "STR     R3, [R4]\n"        
+"loc_FF965D00:\n"                           
+                                        
+                "LDR     R1, =0x61548\n"    
+                "LDR     R0, =0x61598\n"    
+                "LDR     R2, [R1]\n"        
+                "LDR     R3, [R0]\n"        
+                "LDR     R0, =0x61570\n"    
+                "ADD     R2, R2, R3,LSL#4\n" 
+                "MVN     R3, #0x9F\n"       
+                "ADD     R2, R2, R2,LSL#2\n" 
+                "ADD     R3, R3, #0x40000000\n" 
+                "SUB     R3, R3, R2,LSL#1\n" 
+                "LDR     R1, [R0,#4]\n"     
+                "MOV     R4, R3\n"          
+                "MOV     R5, #0\n"          
+                "CMP     R1, R5\n"          
+                "BHI     loc_FF965D4C\n"    
+                "BNE     loc_FF965D70\n"    
+                "LDR     R3, [R0]\n"        
+                "CMP     R3, R4\n"          
+                "BLS     loc_FF965D70\n"    
+"loc_FF965D4C:\n"                           
+                "LDR     R4, =0x61580\n"    
+                "LDR     R1, [R4]\n"        
+                "CMP     R1, #0\n"          
+                "BNE     loc_FF965D70\n"    
+                "MOV     R0, #0x3140\n"     
+                "ADD     R0, R0, #8\n"      
+                "BL      sub_FF98B0C4\n"    
+                "MOV     R3, #1\n"          
+                "STR     R3, [R4]\n"        
+"loc_FF965D70:\n"                           
+                                        
+                "LDR     R3, =0x61598\n"    
+                "LDR     R2, [R3]\n"        
+                "CMP     R2, #0x3C\n"       
+                "BNE     loc_FF965DA8\n"    
+                "LDR     R3, =0x615AA\n"    
+                "LDRH    R2, [R3]\n"        
+                "CMP     R2, #2\n"          
+                "BNE     loc_FF965DA8\n"    
+                "LDR     R3, =0x61518\n"    
+                "MOV     R2, #0x34800\n"    
+                "LDR     R1, [R3]\n"        
+                "ADD     R2, R2, #0x90\n"   
+                "CMP     R1, R2\n"          
+                "B       loc_FF965DD0\n"    
+"loc_FF965DA8:\n"                           
+                                        
+                "LDR     R3, =0x61598\n"    
+                "LDR     R0, =0x61530\n"    
+                "LDR     R2, [R3]\n"        
+                "LDR     R12, =0x61518\n"   
+                "LDR     R1, [R0]\n"        
+                "ADD     R3, R2, R2,LSL#2\n" 
+                "ADD     R2, R2, R3,LSL#1\n" 
+                "LDR     R0, [R12]\n"       
+                "RSB     R1, R2, R1\n"      
+                "CMP     R0, R1\n"          
+"loc_FF965DD0:\n"                           
+                "BLS     loc_FF965DF8\n"    
+                "LDR     R4, =0x61580\n"    
+                "LDR     R1, [R4]\n"        
+                "CMP     R1, #0\n"          
+                "BNE     loc_FF965DF8\n"    
+                "MOV     R0, #0x3140\n"     
+                "ADD     R0, R0, #8\n"      
+                "BL      sub_FF98B0C4\n"    
+                "MOV     R3, #1\n"          
+                "STR     R3, [R4]\n"        
+"loc_FF965DF8:\n"                           
+                                        
+                "LDR     R3, =0x61570\n"    
+                "LDR     R12, =0x61560\n"   
+                "LDMIA   R3, {R1,R2}\n"     
+                "LDR     R0, [R12]\n"       
+                "MOV     R4, #0\n"          
+                "MOV     R3, #0x18\n"       
+                "ADDS    R1, R1, R0\n"      
+                "ADC     R2, R2, #0\n"      
+                "ADDS    R1, R1, R3\n"      
+                "ADC     R2, R2, R4\n"      
+                "CMP     R2, #0\n"          
+                "BHI     loc_FF965E34\n"    
+                "BNE     loc_FF965E3C\n"    
+                "CMP     R1, #0x40000000\n" 
+               // "BLS     loc_FF965E3C\n"    // -
+
+                "B       loc_FF965E3C\n"      // +
+
+"loc_FF965E34:\n"                           
+                "MOV     R0, #0x80000007\n" 
+                "B       loc_FF965E40\n"    
+"loc_FF965E3C:\n"                           
+                                        
+                "MOV     R0, #0\n"          
+"loc_FF965E40:\n"                           
+                                        
+                "ADD     SP, SP, #0x14\n"   
+                "LDMFD   SP!, {R4-R11,PC}\n" 
+
+ );
+}
+
+
+void __attribute__((naked,noinline)) sub_FF964B98_my(){
+ asm volatile(
+                "CMP     R2, #1\n"          
+                "STMFD   SP!, {R4-R8,R10,LR}\n" 
+                "MOV     R10, R0\n"         
+                "MOV     R8, R1\n"          
+                "MOVEQ   R3, #0x79\n"       
+                "STREQ   R3, [R8]\n"        
+                "LDMEQFD SP!, {R4-R8,R10,PC}\n" 
+                "LDR     R1, =0x61274\n"    
+                "LDR     R5, [R1]\n"        
+                "LDR     R3, =0x6127C\n"    
+                "CMP     R5, #0\n"          
+                "LDR     R0, [R3]\n"        
+                "BEQ     loc_FF964BE0\n"    
+                "LDR     R2, =0x61280\n"    
+                "LDR     R3, [R2]\n"        
+                "CMP     R3, #1\n"          
+                "BNE     loc_FF964BF4\n"    
+                "B       loc_FF964BE4\n"    
+"loc_FF964BE0:\n"                           
+                "LDR     R2, =0x61280\n"    
+"loc_FF964BE4:\n"                           
+                "MOV     R3, #0\n"          
+                "STR     R3, [R2]\n"        
+                "STR     R10, [R1]\n"       
+                "B       loc_FF964CB4\n"    
+"loc_FF964BF4:\n"                           
+                "LDR     R3, =0x61278\n"    
+                "LDR     R2, [R3]\n"        
+                "LDR     R7, =table1\n" // +  0xFF964984
+                "RSB     R3, R2, R2,LSL#3\n" 
+                "MOV     R4, R3,LSL#3\n"    
+                "LDR     R1, [R7,R4]\n"     
+                "ADD     R2, R2, R2,LSL#1\n" 
+                "LDR     R6, =table2\n"  // +  0xFF964A2C
+                "MOV     LR, R2,LSL#2\n"    
+                "RSB     R12, R1, R5\n"     
+                "LDR     R3, [R6,LR]\n"     
+                "CMP     R12, #0\n"         
+                "RSB     R1, R3, R5\n"      
+                "BLE     loc_FF964C60\n"    
+                "ADD     R3, R7, #4\n"      
+                "LDR     R2, [R3,R4]\n"     
+                "CMP     R2, R12\n"         
+                "ADDGE   R0, R0, #1\n"      
+                "BGE     loc_FF964C54\n"    
+                "ADD     R3, R7, #8\n"      
+                "LDR     R2, [R3,R4]\n"     
+                "CMP     R2, R12\n"         
+                "ADDGE   R0, R0, #2\n"      
+                "ADDLT   R0, R0, #3\n"      
+"loc_FF964C54:\n"                           
+            //  "CMP     R0, #0xE\n"   // -     
+            //  "MOVGE   R0, #0xE\n"   // -     
+
+                "CMP     R0, #0x1A\n"  // +      
+                "MOVGE   R0, #0x1A\n"  // +      
+
+                "B       loc_FF964C98\n"    
+"loc_FF964C60:\n"                           
+                "CMP     R1, #0\n"          
+                "BGE     loc_FF964C98\n"    
+                "ADD     R3, R6, #4\n"      
+                "LDR     R2, [R3,LR]\n"     
+                "CMP     R2, R1\n"          
+                "SUBLE   R0, R0, #1\n"      
+                "BLE     loc_FF964C90\n"    
+                "ADD     R3, R6, #8\n"      
+                "LDR     R2, [R3,LR]\n"     
+                "CMP     R2, R1\n"          
+                "SUBLE   R0, R0, #2\n"      
+                "SUBGT   R0, R0, #3\n"      
+"loc_FF964C90:\n"                           
+                "CMP     R0, #0\n"          
+                "MOVLT   R0, #0\n"          
+"loc_FF964C98:\n"                           
+                                        
+                "LDR     R1, =0x6127C\n"    
+                "LDR     R3, [R1]\n"        
+                "CMP     R0, R3\n"          
+                "LDRNE   R2, =0x61280\n"    
+                "MOVNE   R3, #1\n"          
+                "STRNE   R0, [R1]\n"        
+                "STRNE   R3, [R2]\n"        
+"loc_FF964CB4:\n"                           
+                "LDR     R3, =0x6127C\n"    
+            //  "LDR     R1, =0x65E0\n"     //-
+                "LDR     R1, =video_mode\n" //+
+                "LDR     R0, [R3]\n"        
+                "LDR     R2, =CompressionRateTable\n" //+ 0xFF964948
+                "LDR     R12, [R1]\n"
+
+                "LDR     R12, [R12]\n" //+
+                                 
+                "LDR     LR, [R2,R0,LSL#2]\n" 
+                "LDR     R3, =0x61274\n"    
+                "CMP     R12, #1\n"         
+                "STR     R10, [R3]\n"       
+                "STR     LR, [R8]\n"        
+           //   "MOVEQ   R3, #0xB\n"  //-     
+
+                "LDREQ   R3, =video_quality\n"  //+               
+                "LDREQ   R3, [R3]\n"      //+              
+                "LDREQ   R3, [R3]\n"      //+              
+
+                "STREQ   R3, [R8]\n"        
+                "LDMFD   SP!, {R4-R8,R10,PC}\n" 
+ );
+}
+
Index: /trunk/platform/s3is/sub/100a/stubs_auto.S
===================================================================
--- /trunk/platform/s3is/sub/100a/stubs_auto.S	(revision 511)
+++ /trunk/platform/s3is/sub/100a/stubs_auto.S	(revision 511)
@@ -0,0 +1,119 @@
+/* THIS FILE IS GENERATED */
+/* DO NOT EDIT THIS FILE! */
+
+#include "stubs_asm.h"
+
+STUB(FF8111C4)
+STUB(FF8112B0)
+STUB(FF811370)
+STUB(FF811708)
+STUB(FF81172C)
+STUB(FF81196C)
+STUB(FF8119C8)
+STUB(FF8119D4)
+STUB(FF8119F8)
+STUB(FF811A14)
+STUB(FF811A40)
+STUB(FF81282C)
+STUB(FF8128FC)
+STUB(FF813B80)
+STUB(FF81FDA4)
+STUB(FF81FF40)
+STUB(FF8204BC)
+STUB(FF8208D4)
+STUB(FF821068)
+STUB(FF821250)
+STUB(FF821A18)
+STUB(FF824B88)
+STUB(FF834454)
+STUB(FF834528)
+STUB(FF864E7C)
+STUB(FF86E6E4)
+STUB(FF86F2B8)
+STUB(FF86F390)
+STUB(FF86F494)
+STUB(FF86FBC8)
+STUB(FF86FC18)
+STUB(FF86FCD4)
+STUB(FF86FE24)
+STUB(FF86FF40)
+STUB(FF86FFC8)
+STUB(FF870140)
+STUB(FF88034C)
+STUB(FF8984C8)
+STUB(FF898634)
+STUB(FF962E94)
+STUB(FF962EB4)
+STUB(FF9632B0)
+STUB(FF9634C0)
+STUB(FF96396C)
+STUB(FF963B7C)
+STUB(FF963C04)
+STUB(FF963C54)
+STUB(FF963D7C)
+STUB(FF963DA0)
+STUB(FF963F30)
+STUB(FF964018)
+STUB(FF9641DC)
+STUB(FF964370)
+STUB(FF964B98)
+STUB(FF965910)
+STUB(FF965E94)
+STUB(FF966184)
+STUB(FF977E9C)
+STUB(FF9783E4)
+STUB(FF979F2C)
+STUB(FF97A124)
+STUB(FF97A320)
+STUB(FF97B384)
+STUB(FF97B724)
+STUB(FF97B734)
+STUB(FF97C09C)
+STUB(FF97C180)
+STUB(FF97C1E8)
+STUB(FF97C7A8)
+STUB(FF97C7B8)
+STUB(FF97C7F4)
+STUB(FF97CD38)
+STUB(FF97CD9C)
+STUB(FF97CDDC)
+STUB(FF97D120)
+STUB(FF97D1A4)
+STUB(FF97D2A0)
+STUB(FF97D368)
+STUB(FF97D504)
+STUB(FF97D598)
+STUB(FF97D654)
+STUB(FF97D740)
+STUB(FF97D810)
+STUB(FF97D970)
+STUB(FF97D9C4)
+STUB(FF97DCCC)
+STUB(FF97DD78)
+STUB(FF97DDB0)
+STUB(FF97DF88)
+STUB(FF97E4FC)
+STUB(FF983D84)
+STUB(FF983D90)
+STUB(FF983DA4)
+STUB(FF986B94)
+STUB(FF98B0C4)
+STUB(FF9C0724)
+STUB(FF9E6838)
+STUB(FF9E6848)
+STUB(FFB01384)
+STUB(FFB37368)
+STUB(FFB373E0)
+STUB(FFB43814)
+STUB(FFB4AF3C)
+STUB(FFB4B5CC)
+STUB(FFB50BA0)
+STUB(FFB510A0)
+STUB(FFB55D34)
+STUB(FFB567AC)
+STUB(FFB58010)
+STUB(FFB58750)
+STUB(FFB5D9B8)
+STUB(FFB61AE8)
+STUB(FFB648A8)
+STUB(FFB69428)
Index: /trunk/platform/s3is/sub/100a/Makefile
===================================================================
--- /trunk/platform/s3is/sub/100a/Makefile	(revision 511)
+++ /trunk/platform/s3is/sub/100a/Makefile	(revision 511)
@@ -0,0 +1,6 @@
+topdir=../../../../
+
+OBJS=boot.o stubs_min.o stubs_auto.o stubs_entry.o lib.o stubs_entry_2.o capt_seq.o movie_rec.o mount.o
+STUBS_AUTO_DEPS=boot.c capt_seq.c movie_rec.c mount.c
+
+include $(topdir)/platform/makefile_sub.inc
Index: /trunk/platform/s3is/sub/Makefile
===================================================================
--- /trunk/platform/s3is/sub/Makefile	(revision 511)
+++ /trunk/platform/s3is/sub/Makefile	(revision 511)
@@ -0,0 +1,8 @@
+topdir=../../../
+include $(topdir)makefile.inc
+
+SUBDIRS=$(PLATFORMSUB)
+
+all: all-recursive
+
+clean: clean-recursive
Index: /trunk/platform/s3is/shooting.c
===================================================================
--- /trunk/platform/s3is/shooting.c	(revision 511)
+++ /trunk/platform/s3is/shooting.c	(revision 511)
@@ -0,0 +1,101 @@
+#define PARAM_FILE_COUNTER      0x34
+
+#include "platform.h"
+
+const ApertureSize aperture_sizes_table[] = {
+    {  9, 283, "2.7" },
+    { 10, 320, "3.2" },
+    { 11, 352, "3.5" },
+    { 12, 384, "4.0" },
+    { 13, 416, "4.5" },
+    { 14, 448, "5.0" },
+    { 15, 480, "5.6" },
+    { 16, 512, "6.3" },
+    { 17, 544, "7.1" },
+    { 18, 576, "8.0" },
+};
+
+const ShutterSpeed shutter_speeds_table[] = {
+    { -12, -384, "15", 15000000 },
+    { -11, -352, "13", 13000000 },
+    { -10, -320, "10", 10000000 },
+    {  -9, -288, "8",   8000000 },
+    {  -8, -256, "6",   6000000 },
+    {  -7, -224, "5",   5000000 },
+    {  -6, -192, "4",   4000000 },
+    {  -5, -160, "3.2", 3200000 },
+    {  -4, -128, "2.5", 2500000 },
+    {  -3,  -96, "2",   2000000 },
+    {  -2,  -64, "1.6", 1600000 },
+    {  -1,  -32, "1.3", 1300000 },
+    {   0,    0, "1",   1000000 },
+    {   1,   32, "0.8",  800000 },
+    {   2,   64, "0.6",  600000 },
+    {   3,   96, "0.5",  500000 },
+    {   4,  128, "0.4",  400000 },
+    {   5,  160, "0.3",  300000 },
+    {   6,  192, "1/4",  250000 },
+    {   7,  224, "1/5",  200000 },
+    {   8,  256, "1/6",  166667 },
+    {   9,  288, "1/8",  125000 },
+    {  10,  320, "1/10", 100000 },
+    {  11,  352, "1/13",  76923 },
+    {  12,  384, "1/15",  66667 },
+    {  13,  416, "1/20",  50000 },
+    {  14,  448, "1/25",  40000 },
+    {  15,  480, "1/30",  33333 },
+    {  16,  512, "1/40",  25000 },
+    {  17,  544, "1/50",  20000 },
+    {  18,  576, "1/60",  16667 },
+    {  19,  608, "1/80",  12500 },
+    {  20,  640, "1/100", 10000 },
+    {  21,  672, "1/125",  8000 },
+    {  22,  704, "1/160",  6250 },
+    {  23,  736, "1/200",  5000 },
+    {  24,  768, "1/250",  4000 },
+    {  25,  800, "1/320",  3125 },
+    {  26,  832, "1/400",  2500 },
+    {  27,  864, "1/500",  2000 },
+    {  28,  896, "1/640",  1563 },
+    {  29,  928, "1/800",  1250 },
+    {  30,  960, "1/1000", 1000 },
+    {  31,  992, "1/1250",  800 },
+    {  32, 1021, "1/1600",  625 },
+    {  33, 1053, "1/2000",  500 },
+    {  34, 1084, "1/2500",  400 },
+    {  35, 1117, "1/3200",  313 },
+};
+
+const ISOTable iso_table[] = {
+    { -1,    1,   "HI", -1},
+    {  0,    0, "Auto", -1},
+    {  1,   80,   "80", -1},
+    {  2,  100,  "100", -1},
+    {  3,  200,  "200", -1},
+    {  4,  400,  "400", -1},
+    {  5,  800,  "800", -1},
+};          
+
+#include "../generic/shooting.c"
+
+long get_file_next_counter() {
+    return ((get_file_counter()>>4)+1)<<4;
+}
+
+long get_target_file_num() {
+    long n;
+    
+    n = get_file_next_counter();
+    n = (n>>4)&0x3FFF;
+    return n;
+}
+
+long get_target_dir_num() {
+    long n;
+    
+    n = get_file_next_counter();
+    n = (n>>18)&0x3FF;
+    return n;
+}
+
+int circle_of_confusion = 5;
Index: /trunk/platform/s3is/Makefile
===================================================================
--- /trunk/platform/s3is/Makefile	(revision 511)
+++ /trunk/platform/s3is/Makefile	(revision 511)
@@ -0,0 +1,26 @@
+curdir=./
+topdir=../../
+
+include $(topdir)makefile.inc
+
+CFLAGS+=-DLOW_LEVEL
+
+SUBDIRS=sub
+
+all: all-recursive libplatform.a
+
+OBJS=main.o lib.o wrappers.o kbd.o shooting.o
+# stubs_init.o
+
+kbd.o: kbd.c ../generic/kbd.c
+lib.o: lib.c ../generic/lib.c
+main.o: main.c ../generic/main.c
+shooting.o: shooting.c ../generic/shooting.c
+wrappers.o: wrappers.c ../generic/wrappers.c
+
+libplatform.a: $(OBJS)
+
+clean: clean-recursive
+	rm -f $(OBJS) libplatform.a
+
+include $(topdir)bottom.inc
Index: /trunk/platform/ixus65_sd630/kbd.c
===================================================================
--- /trunk/platform/ixus65_sd630/kbd.c	(revision 511)
+++ /trunk/platform/ixus65_sd630/kbd.c	(revision 511)
@@ -0,0 +1,356 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+#include "keyboard.h"
+
+#define KEY_MASK 0x17FF
+
+#define NEW_SS (0x2000)
+#define SD_READONLY_FLAG (0x20000)
+
+typedef struct {
+    long hackkey;
+    long canonkey;
+} KeyMap;
+
+long kbd_new_state[3];
+long kbd_prev_state[3];
+long kbd_mod_state = KEY_MASK;
+long debug_kbd_state_diff;
+
+static KeyMap keymap[];
+static long last_kbd_key = 0;
+static int usb_power=0;
+static int remote_key=0;
+static int remote_count=0;
+
+#ifndef MALLOCD_STACK
+static char kbd_stack[NEW_SS];
+#endif
+
+long __attribute__((naked)) wrap_kbd_p1_f() ;
+
+static void __attribute__((noinline)) hook_kbd_task_proceed()
+{
+    while (physw_run){
+        _SleepTask(5);
+
+        if (wrap_kbd_p1_f() == 1) // Readout key state via camera function
+        {
+            _kbd_p2_f();
+        }
+
+    }
+}
+
+void __attribute__((naked,noinline)) mykbd_task()
+{
+    /* WARNING
+     * Stack pointer manipulation performed here!
+     * This means (but not limited to):
+     *  function arguments destroyed;
+     *  function CAN NOT return properly;
+     *  MUST NOT call or use stack variables before stack
+     *  is setup properly;
+     *
+     */
+
+    register int i;
+    register long *newstack;
+
+#ifndef MALLOCD_STACK
+    newstack = (void*)kbd_stack;
+#else
+    newstack = malloc(NEW_SS);
+#endif
+
+    for (i=0;i<NEW_SS/4;i++)
+        newstack[i]=0xdededede;
+
+    asm volatile (
+        "MOV    SP, %0"
+        :: "r"(((char*)newstack)+NEW_SS)
+        : "memory"
+    );
+
+    hook_kbd_task_proceed();
+
+    /* function can be modified to restore SP here...
+     */
+
+    _ExitTask();
+}
+
+
+long __attribute__((naked,noinline)) wrap_kbd_p1_f()
+{
+
+    asm volatile(
+                "STMFD   SP!, {R4-R7,LR}\n"
+                "SUB     SP, SP, #0xC\n"
+                "BL      _kbd_read_keys\n"
+                "BL      hook_kbd_handle_keys\n"
+                "B       _kbd_p1_f_cont\n"        // Continue original function execution
+    );
+    return 0; // shut up the compiler
+}
+
+#if CAM_FEATURE_FEATHER
+//extern int touch_keys_angle;
+#endif
+
+#define IN(base, value) ((value < base + 20) && (value > base - 20))
+
+/**
+ * Handles and forwards key settings to key processing routines
+ */
+void hook_kbd_handle_keys()
+{
+    kbd_prev_state[0] = kbd_new_state[0];
+    kbd_prev_state[1] = kbd_new_state[1];
+    kbd_prev_state[2] = kbd_new_state[2];
+
+    kbd_new_state[0] = physw_status[0];
+    kbd_new_state[1] = physw_status[1];
+    kbd_new_state[2] = physw_status[2];
+
+    static int taskFeatherID = 0;
+
+    if (taskFeatherID == 0) {
+        taskFeatherID = taskNameToId("tFeather");
+        printf("taskFeatherID:%x\n", taskFeatherID);
+    }
+
+
+
+/*
+    int key_emu = 0;
+    int canonkey = 0;
+    int i;
+
+    if (IN(250, touch_keys_angle)) {
+        key_emu = KEY_RIGHT;
+    }
+    if (IN(450, touch_keys_angle)) {
+        key_emu = KEY_DOWN;
+    }
+    if (IN(675, touch_keys_angle)) {
+        key_emu = KEY_LEFT;
+    }
+    if (IN(870, touch_keys_angle)) {
+        key_emu = KEY_UP;
+    }
+    
+    if (key_emu != 0) {
+        for (i=0; keymap[i].hackkey; i++){
+            if (keymap[i].hackkey == key_emu) {
+                canonkey = keymap[i].canonkey;
+                break;;
+            }
+        }
+    }
+
+    if (canonkey != 0) {
+        kbd_new_state[2] = kbd_new_state[2] & ~canonkey;
+    }
+*/
+    
+    if (kbd_process() == 0){
+        // leave it ...
+#if CAM_FEATURE_FEATHER
+        taskResume(taskFeatherID);
+#endif
+    } else {
+        // Drop platform keys to none, and simulate ordered key presses
+        physw_status[2] = (physw_status[2] & (~KEY_MASK)) | (kbd_mod_state & KEY_MASK);
+#if CAM_FEATURE_FEATHER
+        taskSuspend(taskFeatherID);
+
+        // We still need this sema when simulating key presses
+        if (kbd_mod_state != KEY_MASK) {
+            taskResume(taskFeatherID);
+        }
+
+#endif
+    }
+
+    // Drop SD readonly status
+    physw_status[2] = physw_status[2] & ~SD_READONLY_FLAG;
+
+}
+
+/****************/
+
+
+void kbd_key_press(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+        if (keymap[i].hackkey == key){
+            kbd_mod_state &= ~keymap[i].canonkey;
+            return;
+        }
+    }
+}
+
+void kbd_key_release(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+        if (keymap[i].hackkey == key){
+            kbd_mod_state |= keymap[i].canonkey;
+            return;
+        }
+    }
+}
+
+void kbd_key_release_all()
+{
+    kbd_mod_state |= KEY_MASK;
+}
+
+long kbd_is_key_pressed(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+        if (keymap[i].hackkey == key){
+            return ((kbd_new_state[2] & keymap[i].canonkey) == 0) ? 1:0;
+        }
+    }
+    return 0;
+}
+
+long kbd_is_key_clicked(long key)
+{
+    int i;
+    
+    for (i=0;keymap[i].hackkey;i++){
+        if (keymap[i].hackkey == key){
+            return ((kbd_prev_state[2] & keymap[i].canonkey) != 0) &&
+                    ((kbd_new_state[2] & keymap[i].canonkey) == 0);
+        }
+    }
+    return 0;
+}
+
+long kbd_get_pressed_key()
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+        if ((kbd_new_state[2] & keymap[i].canonkey) == 0){
+            return keymap[i].hackkey;
+        }
+    }
+    return 0;
+}
+
+long kbd_get_clicked_key()
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+        if (((kbd_prev_state[2] & keymap[i].canonkey) != 0) &&
+            ((kbd_new_state[2] & keymap[i].canonkey) == 0)){
+            return keymap[i].hackkey;
+        }
+    }
+    return 0;
+}
+
+void kbd_reset_autoclicked_key() {
+    last_kbd_key = 0;
+}
+
+long kbd_get_autoclicked_key() {
+    static long last_kbd_time = 0, press_count = 0;
+    register long key, t;
+
+    key=kbd_get_clicked_key();
+    if (key) {
+        last_kbd_key = key;
+        press_count = 0;
+        last_kbd_time = get_tick_count();
+        return key;
+    } else {
+        if (last_kbd_key && kbd_is_key_pressed(last_kbd_key)) {
+            t = get_tick_count();
+            if (t-last_kbd_time > ( press_count ? KBD_REPEAT_DELAY : KBD_INITIAL_DELAY) ) {
+                ++press_count;
+                last_kbd_time = t;
+                return last_kbd_key;
+            } else {
+                return 0;
+            }
+        } else {
+            last_kbd_key = 0;
+            return 0;
+        }
+    }
+}
+
+long kbd_use_zoom_as_mf() {
+    static long v;
+    static long zoom_key_pressed = 0;
+
+    if (kbd_is_key_pressed(KEY_ZOOM_IN) && (mode_get()&MODE_MASK) == MODE_REC) {
+        get_property_case(12, &v, 4);
+        if (v) {
+            kbd_key_release_all();
+            kbd_key_press(KEY_RIGHT);
+            zoom_key_pressed = KEY_ZOOM_IN;
+            return 1;
+        }
+    } else {
+        if (zoom_key_pressed==KEY_ZOOM_IN) {
+            kbd_key_release(KEY_RIGHT);
+            zoom_key_pressed = 0;
+            return 1;
+        }
+    }
+    if (kbd_is_key_pressed(KEY_ZOOM_OUT) && (mode_get()&MODE_MASK) == MODE_REC) {
+        get_property_case(12, &v, 4);
+        if (v) {
+            kbd_key_release_all();
+            kbd_key_press(KEY_LEFT);
+            zoom_key_pressed = KEY_ZOOM_OUT;
+            return 1;
+        }
+    } else {
+        if (zoom_key_pressed==KEY_ZOOM_OUT) {
+            kbd_key_release(KEY_LEFT);
+            zoom_key_pressed = 0;
+            return 1;
+        }
+    }
+    return 0;
+}
+
+int get_usb_power(int edge)
+{
+	int x;
+
+	if (edge) return remote_key;
+	x = usb_power;
+	usb_power = 0;
+	return x;
+}
+
+static KeyMap keymap[] = {
+    /* tiny bug: key order matters. see kbd_get_pressed_key()
+     * for example
+     */
+	{ KEY_UP	, 0x00000001 },
+	{ KEY_DOWN	, 0x00000002 },
+	{ KEY_LEFT	, 0x00000008 },
+	{ KEY_RIGHT	, 0x00000004 },
+	{ KEY_SET	, 0x00000100 },
+	{ KEY_SHOOT_FULL, 0x00000030 }, // note 3 here!
+	{ KEY_SHOOT_HALF, 0x00000010 },
+	{ KEY_ZOOM_IN	, 0x00000040 },
+	{ KEY_ZOOM_OUT	, 0x00000080 },
+	{ KEY_MENU	, 0x00000200 },
+	{ KEY_DISPLAY	, 0x00000400 },
+	{ KEY_PRINT	, 0x00001000 },
+//	{ KEY_ERASE	, 0x00000800 },
+	{ KEY_DUMMY	, 0x00001000 },
+	{ 0, 0 }
+};
Index: /trunk/platform/ixus65_sd630/wrappers.c
===================================================================
--- /trunk/platform/ixus65_sd630/wrappers.c	(revision 511)
+++ /trunk/platform/ixus65_sd630/wrappers.c	(revision 511)
@@ -0,0 +1,16 @@
+#include "../generic/wrappers.c"
+
+long lens_get_focus_pos()
+{
+    return _GetFocusLensSubjectDistance();
+}
+
+long lens_get_target_distance()
+{
+    return _GetCurrentTargetDistance();
+}
+
+long lens_get_focus_pos_from_lense()
+{
+    return _GetFocusLensSubjectDistanceFromLens();
+}
Index: /trunk/platform/ixus65_sd630/main.c
===================================================================
--- /trunk/platform/ixus65_sd630/main.c	(revision 511)
+++ /trunk/platform/ixus65_sd630/main.c	(revision 511)
@@ -0,0 +1,85 @@
+
+#include "../generic/main.c"
+
+void movie_record_task()
+{
+}
+
+long get_vbatt_min()
+{
+    return 3550;
+}
+
+long get_vbatt_max()
+{
+    return 4110;
+}
+
+static const int fl_tbl[] = {5800, 7109, 8462, 10093, 12120, 14421, 17400};
+#define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0]))
+#define CF_EFL 60345
+
+const int zoom_points = NUM_FL;
+
+int get_effective_focal_length(int zp) {
+    return (CF_EFL*get_focal_length(zp))/10000;
+}
+
+int get_focal_length(int zp) {
+    if (zp<0) return fl_tbl[0];
+    else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1];
+    else return fl_tbl[zp];
+}
+
+int get_zoom_x(int zp) {
+    if (zp<1) return 10;
+    else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0];
+    else return fl_tbl[zp]*10/fl_tbl[0];
+}
+
+static struct {
+	int hackmode;
+	int canonmode;
+} modemap[] = {
+    { MODE_AUTO,               6  },
+    { MODE_P,                  1  },
+    { MODE_TV,                 3  },
+    { MODE_AV,                 2  },
+    { MODE_M,                  0  },
+    { MODE_PORTRAIT,           9  },
+    { MODE_NIGHT,              8  },
+    { MODE_LANDSCAPE,          7  },
+    { MODE_VIDEO_STD,          18 },
+    { MODE_STITCH,             5  },
+    { MODE_MY_COLORS,          4  },
+    { MODE_SCN_WATER,          13 },
+    { MODE_SCN_NIGHT,          15 },
+    { MODE_SCN_CHILD,          16 },
+    { MODE_SCN_PARTY,          14 },
+    { MODE_SCN_GRASS,          10 },
+    { MODE_SCN_SNOW,           11 },
+    { MODE_SCN_BEACH,          12 },
+    { MODE_SCN_FIREWORK,       17 }
+};
+#define MODESCNT (sizeof(modemap)/sizeof(modemap[0]))
+
+/*
+   9xxxx - view
+   3xxxx - video
+   bxxxx - photo
+*/
+
+
+int mode_get() {
+    int mode, i, t=0xFF;
+
+    mode  = (physw_status[2] & 0x00002000)?MODE_REC:MODE_PLAY;
+    
+    _GetPropertyCase(0, &t, 4);
+    for (i=0; i<MODESCNT; ++i) {
+	if (modemap[i].canonmode == t) {
+	    return (mode | (modemap[i].hackmode & MODE_SHOOTING_MASK));
+	}
+    }
+    return (mode);
+}
Index: /trunk/platform/ixus65_sd630/notes.txt
===================================================================
--- /trunk/platform/ixus65_sd630/notes.txt	(revision 511)
+++ /trunk/platform/ixus65_sd630/notes.txt	(revision 511)
@@ -0,0 +1,11 @@
+****************************************
+
+Camera depending notes: 
+
+- ixus65_sd630 uses Propset 1 of Properties (see http://tinyurl.com/6zbv9b)
+- ixus65_sd630 does NOT have a real IRIS Diaphragm, it only has an ND Filter! 
+Mind this.
+- you can NOT use video overrides (as of this version)
+
+
+
Index: /trunk/platform/ixus65_sd630/lib.c
===================================================================
--- /trunk/platform/ixus65_sd630/lib.c	(revision 511)
+++ /trunk/platform/ixus65_sd630/lib.c	(revision 511)
@@ -0,0 +1,5 @@
+#include "../generic/lib.c"
+
+int get_flash_params_count(void){
+ return 90;
+}
Index: /trunk/platform/ixus65_sd630/sub/100a/stubs_entry_ida.S
===================================================================
--- /trunk/platform/ixus65_sd630/sub/100a/stubs_entry_ida.S	(revision 511)
+++ /trunk/platform/ixus65_sd630/sub/100a/stubs_entry_ida.S	(revision 511)
@@ -0,0 +1,965 @@
+
+NSTUB(eventproc_printclock, 0xff812e24)
+NSTUB(eventproc_StopClockSaver, 0xff812f28)
+NSTUB(eventproc_SetLClk72MHz, 0xff812f44)
+NSTUB(eventproc_SetLClk36MHz, 0xff812f54)
+NSTUB(eventproc_SetLClk18MHz, 0xff812f64)
+
+NSTUB(eventproc_SetHClk72MHz, 0xff81300c)
+NSTUB(eventproc_SetHClk36MHz, 0xff813050)
+NSTUB(eventproc_SetHClk18MHz, 0xff813078)
+NSTUB(eventproc_SetMClk72MHz, 0xff8130bc)
+NSTUB(eventproc_SetMClk36MHz, 0xff813100)
+NSTUB(eventproc_SetMClk18MHz, 0xff813128)
+
+NSTUB(eventproc_export_ExecuteEventProcedure, 0xff816bc8)
+
+NSTUB(eventproc_export_ExportToEventProcedure, 0xff816db0)
+NSTUB(eventproc_CreateProxyOfEventProcedure, 0xff817548)
+NSTUB(eventproc_DeleteProxyOfEventProcedure, 0xff8175d0)
+
+NSTUB(eventproc_PutsCameraLogEvent, 0xff8180d8)
+NSTUB(eventproc_ShowCameraLogInfo, 0xff8181e0)
+NSTUB(eventproc_ShowCameraLog, 0xff818284)
+
+NSTUB(eventproc_StartCameraLog, 0xff818470)
+NSTUB(eventproc_StopCameraLog, 0xff818564)
+
+NSTUB(eventproc_export_StartWDT, 0xff81a384)
+NSTUB(eventproc_export_StopWDT, 0xff81a400)
+
+NSTUB(eventproc_export_GetBuildDate, 0xff81a574)
+NSTUB(eventproc_export_GetBuildTime, 0xff81a58c)
+NSTUB(eventproc_export_GetFirmwareVersion, 0xff81a5b0)
+
+NSTUB(eventproc_export_RomCheckSum, 0xff81a698)
+NSTUB(eventproc_export_CheckSumAll, 0xff81a72c)
+NSTUB(eventproc_SystemEventDelete, 0xff81a8e8)
+NSTUB(eventproc_SystemEventInit, 0xff81a92c)
+
+NSTUB(eventproc_export_Dump32, 0xff81a9f4)
+NSTUB(eventproc_FreeMemory, 0xff81ab08)
+NSTUB(eventproc_AllocateMemory, 0xff81ab1c)
+NSTUB(eventproc_Wait, 0xff81ab2c)
+NSTUB(eventproc_Poke32, 0xff81ab40)
+NSTUB(eventproc_Poke16, 0xff81ab64)
+NSTUB(eventproc_Poke8, 0xff81ab88)
+NSTUB(eventproc_Peek32, 0xff81abac)
+NSTUB(eventproc_Peek16, 0xff81abc8)
+NSTUB(eventproc_Peek8, 0xff81abe4)
+NSTUB(eventproc_EraseSignature, 0xff81ac00)
+NSTUB(eventproc_GetSystemTime, 0xff81ac30)
+NSTUB(eventproc_MonSelEvent, 0xff81ac50)
+NSTUB(eventproc_exec, 0xff81ac88)
+
+NSTUB(eventproc_Driver_EnableEventProc, 0xff825f2c)
+
+NSTUB(eventproc_ShowPhySwStatus, 0xff827470)
+NSTUB(eventproc_OnPrintPhySw, 0xff827564)
+NSTUB(eventproc_OffPrintPhySw, 0xff82757c)
+NSTUB(eventproc_GetSwitchStatus, 0xff827590)
+
+NSTUB(eventproc_OffPrintHVSw, 0xff828668)
+NSTUB(eventproc_GetHVSw, 0xff82867c)
+NSTUB(eventproc_OnPrintHVStatus, 0xff82868c)
+NSTUB(eventproc_OffPrintHVStatus, 0xff8286a0)
+
+NSTUB(eventproc_SetFeatherDivision, 0xff829a78)
+NSTUB(eventproc_SetFeatherInterval, 0xff829aa0)
+NSTUB(eventproc_OnPrintFeather, 0xff829ab4)
+NSTUB(eventproc_OffPrintFeather, 0xff829acc)
+NSTUB(eventproc_SetFeatherPrintInterval, 0xff829ae0)
+
+NSTUB(eventproc_GetAdChValue, 0xff82a918)
+NSTUB(eventproc_GetAdVBattBottom, 0xff82a958)
+
+NSTUB(eventproc_SetBattCheckMode, 0xff82ba90)
+NSTUB(eventproc_ShowBattCheckMode, 0xff82bb18)
+NSTUB(eventproc_ShowBattChkAdj, 0xff82bbc4)
+NSTUB(eventproc_GetLBOffset, 0xff82bde4)
+NSTUB(eventproc_LowBat_Result_Print_On, 0xff82bdf4)
+NSTUB(eventproc_LowBat_Result_Print_Off, 0xff82be0c)
+NSTUB(eventproc_BatVoltageToAd, 0xff82be20)
+
+NSTUB(eventproc_VbattGet, 0xff82d154)
+
+NSTUB(eventproc_CalculateBatSenseOffset, 0xff82d4ec)
+
+NSTUB(eventproc_ExecuteLoadTest, 0xff82d800)
+NSTUB(eventproc_TurnOn_LoadTest_DebugMode, 0xff82d810)
+NSTUB(eventproc_TurnOff_LoadTest_DebugMode, 0xff82d824)
+NSTUB(eventproc_LoadTest_Result_Print_On, 0xff82d838)
+NSTUB(eventproc_LoadTest_Result_Print_Off, 0xff82d84c)
+
+NSTUB(eventproc_LEDDrive, 0xff82e778)
+NSTUB(eventproc_AFAssistBeam, 0xff82e7c4)
+NSTUB(eventproc_PostLEDMessage, 0xff82e7e4)
+
+NSTUB(eventproc_BeepDrive, 0xff82f22c)
+NSTUB(eventproc_BeepDriveComp, 0xff82f240)
+
+NSTUB(eventproc_TurnOnVideoOutMode, 0xff82fa54)
+NSTUB(eventproc_TurnOffVideoOutMode, 0xff82faa4)
+
+NSTUB(eventproc_PrePro_Unpack, 0xff89ea3c)
+
+NSTUB(eventproc_Capture_Create, 0xff8a1ba0)
+
+NSTUB(eventproc_ActivateImager, 0xff8cf31c)
+NSTUB(eventproc_QuietImager, 0xff8cf3cc)
+
+NSTUB(eventproc_CancelImager, 0xff8cf63c)
+NSTUB(eventproc_ChangeImagerToWholeSerial, 0xff8cf66c)
+NSTUB(eventproc_ChangeImagerToWholeSerialLineDef, 0xff8cf684)
+NSTUB(eventproc_ChangeImagerToWholeParallel, 0xff8cf69c)
+NSTUB(eventproc_ChangeImagerToWholeParallelHalf, 0xff8cf6b8)
+NSTUB(eventproc_ChangeImagerToSuperWideDraft, 0xff8cf6c8)
+NSTUB(eventproc_ChangeImagerToWideDraft, 0xff8cf6d8)
+NSTUB(eventproc_ChangeImagerToNarrowDraft, 0xff8cf6e8)
+NSTUB(eventproc_ChangeImagerToAlternateDraft, 0xff8cf6f8)
+NSTUB(eventproc_ChangeImagerToJetDraft, 0xff8cf708)
+NSTUB(eventproc_ChangeImagerToPetitNarrow, 0xff8cf718)
+NSTUB(eventproc_ChangeImagerToFocusJet, 0xff8cf728)
+NSTUB(eventproc_ChangeImagerToJumboDraft, 0xff8cf738)
+NSTUB(eventproc_ChangeImagerToDigiconMode, 0xff8cf748)
+NSTUB(eventproc_ChangeImagerToQVGA20Fps, 0xff8cf758)
+NSTUB(eventproc_ChangeImagerToQVGA15Fps, 0xff8cf768)
+NSTUB(eventproc_ChangeImagerToSmearCorrectWide, 0xff8cf778)
+NSTUB(eventproc_ChangeImagerToSmearCorrectSuper, 0xff8cf788)
+NSTUB(eventproc_ChangeImagerToSmearCorrectAlternate, 0xff8cf798)
+NSTUB(eventproc_SetStartLineForNarrowDraft, 0xff8cf7a8)
+NSTUB(eventproc_WithdrawalImagerForEmergency, 0xff8cf7bc)
+NSTUB(eventproc_StillOnMovieTest, 0xff8cf7d8)
+NSTUB(eventproc_SetSmearOn, 0xff8cf8f4)
+NSTUB(eventproc_SetSmearOff, 0xff8cf908)
+
+NSTUB(eventproc_VirtualHeadError, 0xff8d2290)
+
+NSTUB(eventproc_export_EnableOBClampField, 0xff8d4710)
+NSTUB(eventproc_export_DisableOBClampField, 0xff8d4728)
+
+NSTUB(eventproc_export_VirtualImageTimeOut, 0xff8e3858)
+
+NSTUB(eventproc_EF_StartEFCharge, 0xff914298)
+NSTUB(eventproc_EF_StopEFCharge, 0xff9142f8)
+NSTUB(eventproc_EF_StartInternalPreFlash, 0xff914308)
+NSTUB(eventproc_EF_StartInternalMainFlash, 0xff91434c)
+NSTUB(eventproc_EF_SetMainFlashTime, 0xff9143d8)
+NSTUB(eventproc_EF_IsChargeFull, 0xff9143ec)
+
+NSTUB(eventproc_ChangeGradeTable, 0xff931a70)
+
+NSTUB(eventproc_MakeDefData, 0xff931d34)
+NSTUB(eventproc_KizuMarkCheck, 0xff931e8c)
+NSTUB(eventproc_GetDefectCount, 0xff931f14)
+NSTUB(eventproc_RenewThermoLogNo, 0xff931f38)
+
+NSTUB(eventproc_DispDev_EnableEventProc, 0xff932940)
+
+NSTUB(eventproc_DispCon_SetVideoAdjParameter, 0xff934518)
+NSTUB(eventproc_DispCon_GetVideoAdjParameter, 0xff934588)
+NSTUB(eventproc_DispCon_ShowVideoAdjParameter, 0xff9345dc)
+NSTUB(eventproc_DispCon_SaveVideoAdjParameter, 0xff9345f8)
+NSTUB(eventproc_DispCon_ShowColorBar, 0xff934608)
+NSTUB(eventproc_DispCon_ShowFiveStep, 0xff93467c)
+
+NSTUB(eventproc_DispCon_ShowWhiteChart, 0xff934774)
+NSTUB(eventproc_DispCon_ShowBlackChart, 0xff9347b8)
+
+NSTUB(eventproc_DispCon_ShowBitmapColorBar, 0xff9347d4)
+NSTUB(eventproc_DispCon_ShowCustomColorBar, 0xff93483c)
+NSTUB(eventproc_DispCon_SetDisplayType, 0xff9348c4)
+NSTUB(eventproc_DispCon_TurnOnDisplay, 0xff9348e8)
+NSTUB(eventproc_DispCon_TurnOffDisplay, 0xff9348f8)
+NSTUB(eventproc_DispCon_SetMaxBackLightBrightness, 0xff934908)
+
+NSTUB(eventproc_LcdCon_SetLcdDriver, 0xff9373b0)
+NSTUB(eventproc_LcdCon_SetLcdAdjParameter, 0xff9374cc)
+NSTUB(eventproc_LcdCon_GetLcdAdjParameter, 0xff9375b0)
+NSTUB(eventproc_LcdCon_ShowLcdAdjParameter, 0xff937608)
+NSTUB(eventproc_LcdCon_SaveLcdAdjParameter, 0xff937658)
+
+NSTUB(eventproc_LcdCon_SetLcdBackLightBrightness, 0xff937800)
+NSTUB(eventproc_LcdCon_SetLcdBackLightParameter, 0xff937894)
+NSTUB(eventproc_LcdCon_GetLcdBackLightParameter, 0xff937938)
+NSTUB(eventproc_LcdCon_ShowLcdBackLightParameter, 0xff937990)
+NSTUB(eventproc_LcdCon_SaveLcdBackLightParameter, 0xff9379e0)
+
+NSTUB(eventproc_Movie_NormalCompressionRateMode, 0xff956f14)
+NSTUB(eventproc_Movie_HiCompressionRateMode, 0xff956f28)
+
+NSTUB(eventproc_NR_SetDarkSubType, 0xff9657a8)
+NSTUB(eventproc_NR_SetDefectCorrectType, 0xff965804)
+NSTUB(eventproc_NR_GetDarkSubType, 0xff965838)
+NSTUB(eventproc_NR_GetDefectCorrectType, 0xff96587c)
+
+NSTUB(eventproc_export_PT_EraseAllFile, 0xff96a7e0)
+NSTUB(eventproc_export_PT_mod, 0xff96a810)
+NSTUB(eventproc_export_PT_atoi, 0xff96a81c)
+NSTUB(eventproc_export_PT_GetSystemTime, 0xff96a828)
+NSTUB(eventproc_export_PT_SetPropertyCaseString, 0xff96a848)
+NSTUB(eventproc_export_PT_SetPropertyCaseInt, 0xff96a85c)
+NSTUB(eventproc_export_PT_GetPropertyCaseString, 0xff96a884)
+NSTUB(eventproc_export_PT_GetPropertyCaseInt, 0xff96a898)
+NSTUB(eventproc_export_PT_GetLocalTimeString, 0xff96a944)
+NSTUB(eventproc_export_PT_GetLocalDateString, 0xff96a9a0)
+NSTUB(eventproc_export_PT_GetLocalDateAndTimeString, 0xff96aa04)
+NSTUB(eventproc_export_PT_SetMessage, 0xff96aa54)
+NSTUB(eventproc_export_PT_UndispMessage, 0xff96aa7c)
+NSTUB(eventproc_export_PT_PlaySound, 0xff96aa98)
+NSTUB(eventproc_export_PT_LCD_BkColor, 0xff96aab0)
+NSTUB(eventproc_export_PT_LCD_BkColorDef, 0xff96ab6c)
+NSTUB(eventproc_export_PT_BatLvChange_PreWeak, 0xff96aba0)
+NSTUB(eventproc_export_PT_BatLvChange_Weak, 0xff96aba8)
+NSTUB(eventproc_export_PT_BatLvChange_Low, 0xff96abb0)
+NSTUB(eventproc_export_PT_BatLvChange_SysLow, 0xff96abb8)
+NSTUB(eventproc_export_PT_StartBatteryTest, 0xff96abd0)
+NSTUB(eventproc_export_PT_FinishBatteryTest, 0xff96ac30)
+
+NSTUB(eventproc_export_PT_GetBatteryLevel, 0xff96ad28)
+NSTUB(eventproc_export_PT_GetPreWeakBatLv, 0xff96ad40)
+
+NSTUB(eventproc_export_PT_GetWeakBatLv, 0xff96ada8)
+NSTUB(eventproc_export_PT_GetLowBatLv, 0xff96ae10)
+NSTUB(eventproc_export_PT_GetSysLowBatLv, 0xff96ae78)
+NSTUB(eventproc_export_UiMemory_Show, 0xff96aef0)
+
+NSTUB(eventproc_export_HardwareDefect, 0xff96b114)
+
+NSTUB(eventproc_ShowErrorNumberList, 0xff96b1a4)
+
+NSTUB(eventproc_export_CreateController, 0xff96c2c0)
+NSTUB(eventproc_export_DeleteController, 0xff96c378)
+NSTUB(eventproc_export_MoveControllerToTopOfZOrder, 0xff96c4b0)
+NSTUB(eventproc_export_GetSelfControllerHandle, 0xff96c5e8)
+
+NSTUB(eventproc_export_PostLogicalEventForNotPowerType, 0xff96f5c8)
+NSTUB(eventproc_export_PostLogicalEventToUI, 0xff96f644)
+NSTUB(eventproc_export_PostEventShootSeqToUI, 0xff96f6cc)
+NSTUB(eventproc_export_ShowLogicalEventName, 0xff96f734)
+
+NSTUB(eventproc_export_LogiEvnt_LoadCameraLog, 0xff96f87c)
+
+NSTUB(eventproc_export_IsControlEventActive, 0xff9714b8)
+
+NSTUB(eventproc_export_SetScriptMode, 0xff9715ac)
+NSTUB(eventproc_export_UiEvnt_ShowBitMaps, 0xff9715bc)
+
+NSTUB(eventproc_export_UiEvnt_StartDisguiseCradleStatus, 0xff97161c)
+NSTUB(eventproc_export_UiEvnt_StopDisguiseCradleStatus, 0xff971630)
+
+NSTUB(eventproc_export_IsDisableAutoShutdown, 0xff9733c4)
+
+NSTUB(eventproc_export_ShowAutoShutdownTime, 0xff973498)
+NSTUB(eventproc_export_DisableAutoShutdown, 0xff9734cc)
+NSTUB(eventproc_export_EnableAutoShutdown, 0xff9734e4)
+
+NSTUB(eventproc_export_SetAutoShutdownTime, 0xff973778)
+NSTUB(eventproc_export_LockMainPower, 0xff973874)
+NSTUB(eventproc_export_UnlockMainPower, 0xff97390c)
+NSTUB(eventproc_export_GetMainPowerLockCounter, 0xff973a10)
+
+NSTUB(eventproc_PTM_AllResetToFactorySetting, 0xff976248)
+NSTUB(eventproc_PTM_AllResetProperty, 0xff976258)
+
+NSTUB(eventproc_PTM_GetWorkingCaptureMode, 0xff97649c)
+
+NSTUB(eventproc_export_PTM_RestoreUIProperty, 0xff976830)
+
+NSTUB(eventproc_PTM_SetCurrentCaptureMode, 0xff976f38)
+NSTUB(eventproc_PTM_SetCurrentItem, 0xff976f48)
+NSTUB(eventproc_PTM_GetCurrentItem, 0xff976f68)
+NSTUB(eventproc_PTM_NextItem, 0xff976f80)
+NSTUB(eventproc_PTM_PrevItem, 0xff976f98)
+NSTUB(eventproc_PTM_BackupUIProperty, 0xff976fb0)
+NSTUB(eventproc_PTM_SetProprietyEnable, 0xff976fd4)
+
+NSTUB(eventproc_export_CreateDialogBox, 0xff97d698)
+NSTUB(eventproc_export_DeleteDialogBox, 0xff97d8a8)
+NSTUB(eventproc_export_ResizeVirtualWindow, 0xff97d964)
+NSTUB(eventproc_export_MoveDialogBoxPosition, 0xff97d990)
+NSTUB(eventproc_export_DeleteDialogBoxAfterGetTopOfControl, 0xff97da30)
+NSTUB(eventproc_export_SetPropertyToDialogItemWithID, 0xff97da54)
+NSTUB(eventproc_export_GetPropertyFromDialogItemWithID, 0xff97da84)
+
+NSTUB(eventproc_export_AddItemToDialogBox, 0xff97db1c)
+NSTUB(eventproc_export_DeleteItemFromDialogBox, 0xff97dbf0)
+NSTUB(eventproc_export_SetFocusDirectionToDialogItem, 0xff97dcdc)
+NSTUB(eventproc_export_SetFocusItemToDialogItem, 0xff97dee0)
+NSTUB(eventproc_export_GetFocusedItemIDOfDialogItem, 0xff97dff4)
+NSTUB(eventproc_export_GetItemHandleOfDialogBox, 0xff97e02c)
+NSTUB(eventproc_export_DisplayDialogBox, 0xff97e0cc)
+NSTUB(eventproc_export_UndisplayDialogBox, 0xff97e0f4)
+NSTUB(eventproc_export_SetBackgroundColorToDialogBox, 0xff97e11c)
+NSTUB(eventproc_export_RefreshRectangleToDialog, 0xff97e170)
+
+NSTUB(eventproc_export_RegisterRefreshToDialog, 0xff97e1f8)
+NSTUB(eventproc_export_RefreshRegistedRectangleToDialog, 0xff97e2bc)
+NSTUB(eventproc_export_FillRectangleToDialog, 0xff97e330)
+NSTUB(eventproc_export_DrawStringToDialog, 0xff97e390)
+NSTUB(eventproc_export_TransferRectangleToDialog, 0xff97e3f0)
+NSTUB(eventproc_export_TransferBitmapToDialog, 0xff97e460)
+NSTUB(eventproc_export_DrawBinaryBitmapToDialog, 0xff97e4e0)
+NSTUB(eventproc_export_GetDialogBoxWindow, 0xff97e548)
+NSTUB(eventproc_export_SetFocusScopeToDialog, 0xff97e568)
+NSTUB(eventproc_export_GetFocusScopeToDialog, 0xff97e5d8)
+NSTUB(eventproc_export_MoveViewPortPosition, 0xff97e624)
+NSTUB(eventproc_export_ResizeDialogBox, 0xff97e688)
+NSTUB(eventproc_export_MoveDialogControllerToTopOfZOrder, 0xff97e6d4)
+NSTUB(eventproc_export_RegisterChangeLanguageToDialog, 0xff97e6f8)
+NSTUB(eventproc_export_UnregisterChangeLanguageToDialog, 0xff97e740)
+NSTUB(eventproc_export_MoveDialogItemPositionToDialog, 0xff97e77c)
+NSTUB(eventproc_export_ResizeDialogItemToDialog, 0xff97e7b0)
+NSTUB(eventproc_export_GetDialogItemPositionToDialog, 0xff97e7e4)
+NSTUB(eventproc_export_GetDialogItemResolutionToDialog, 0xff97e818)
+NSTUB(eventproc_export_SetOriginTypeToDialog, 0xff97e84c)
+NSTUB(eventproc_export_SetDefaultMovingFocusToDialog, 0xff97e870)
+NSTUB(eventproc_export_LockRefreshDialog, 0xff97e894)
+NSTUB(eventproc_export_UnlockRefreshDialog, 0xff97e8d8)
+
+NSTUB(eventproc_export_KeepDefaultMoveFocusEventToDialog, 0xff97e998)
+
+NSTUB(eventproc_export_InstallDialogItem, 0xff97ed68)
+NSTUB(eventproc_export_CreateDialogItem, 0xff97ee44)
+NSTUB(eventproc_export_DeleteDialogItem, 0xff97ef34)
+NSTUB(eventproc_export_DrawDialogItem, 0xff97efb4)
+NSTUB(eventproc_export_ControlEventHandler, 0xff97f04c)
+NSTUB(eventproc_export_SetPropertyToDialogItem, 0xff97f0c8)
+NSTUB(eventproc_export_GetPropertyFromDialogItem, 0xff97f13c)
+NSTUB(eventproc_export_SetAttributeToDialogItem, 0xff97f1b0)
+NSTUB(eventproc_export_GetAttributeFromDialogItem, 0xff97f224)
+NSTUB(eventproc_export_MoveDialogItemPosition, 0xff97f290)
+NSTUB(eventproc_export_ResizeDialogItem, 0xff97f304)
+NSTUB(eventproc_export_GetDialogItemPosition, 0xff97f384)
+NSTUB(eventproc_export_GetDialogItemResolution, 0xff97f404)
+
+NSTUB(eventproc_StartGUISystem, 0xff982794)
+
+NSTUB(eventproc_ShutdownGUISystem, 0xff9828b8)
+
+NSTUB(eventproc_export_DeletePalette, 0xff982b7c)
+NSTUB(eventproc_export_SetYUVPaletteIndex, 0xff982bf4)
+
+NSTUB(eventproc_export_SetPaletteToPhysicalScreen, 0xff982d34)
+NSTUB(eventproc_export_GetPaletteFromPhysicalScreen, 0xff982d8c)
+
+NSTUB(eventproc_export_SetCurrentPalette, 0xff985ce4)
+NSTUB(eventproc_export_SetSystemColorMode, 0xff985cf4)
+
+NSTUB(eventproc_export_LockPhysicalScreen, 0xff98a5b0)
+NSTUB(eventproc_export_RefreshPhysicalScreen, 0xff98a644)
+NSTUB(eventproc_export_EnableRefreshPhysicalScreen, 0xff98a718)
+NSTUB(eventproc_export_DisableRefreshPhysicalScreen, 0xff98a72c)
+NSTUB(eventproc_export_IsEnableRefreshPhysicalScreen, 0xff98a740)
+
+NSTUB(eventproc_export_PrintBmpVramInfo, 0xff98b054)
+NSTUB(eventproc_export_PrintCurrPalette, 0xff98b084)
+
+NSTUB(eventproc_export_UI_ShowStateOfRecMode, 0xff999bb8)
+NSTUB(eventproc_export_UIFS_SetDialStillRec, 0xff999bd0)
+NSTUB(eventproc_export_UIFS_SetDialMovieRec, 0xff999c10)
+NSTUB(eventproc_export_UIFS_SetDialPlay, 0xff999c50)
+NSTUB(eventproc_export_ModeLevelStillRecForScript, 0xff999c90)
+NSTUB(eventproc_export_ModeLevelMovieRecForScript, 0xff999c9c)
+NSTUB(eventproc_export_ModeLevelPlayForScript, 0xff999ca8)
+NSTUB(eventproc_export_UIFS_StopPostingUIEvent, 0xff999cb4)
+NSTUB(eventproc_export_UIFS_RestartPostingUIEvent, 0xff999cc0)
+NSTUB(eventproc_export_UIFS_SetCaptureModeToP, 0xff999ccc)
+NSTUB(eventproc_export_UIFS_SetCaptureModeToM, 0xff999d08)
+
+NSTUB(eventproc_export_UIFS_Capture, 0xff999d58)
+
+NSTUB(eventproc_export_UIFS_StartMovieRecord, 0xff999d68)
+NSTUB(eventproc_export_UIFS_StopMovieRecord, 0xff999d74)
+NSTUB(eventproc_export_UIFS_PCaseToPTMID, 0xff999dac)
+NSTUB(eventproc_export_UIFS_SetCradleSetting, 0xff999e0c)
+NSTUB(eventproc_UI_RegistDebugEventProc, 0xff99a118)
+
+NSTUB(eventproc_export_SetCurrentCaptureModeType, 0xff9a66a0)
+NSTUB(eventproc_export_GetCurrentCaptureModeType, 0xff9a66f0)
+
+NSTUB(eventproc_export_ShootCon_GetStatus, 0xff9a9c98)
+
+NSTUB(eventproc_export_ShootCon_ShowState, 0xff9ada98)
+
+NSTUB(eventproc_export_ShootCon_SetEventHook, 0xff9ae518)
+NSTUB(eventproc_export_ShootCon_PrintMemoryDump, 0xff9ae544)
+NSTUB(eventproc_export_ShootCon_ShowAllSemaphores, 0xff9ae5d0)
+
+NSTUB(eventproc_StartMovieController, 0xff9af470)
+NSTUB(eventproc_EnableMovieController, 0xff9af4d8)
+NSTUB(eventproc_DisableMovieController, 0xff9af4ec)
+NSTUB(eventproc_ShutdownMovieController, 0xff9af500)
+
+NSTUB(eventproc_GetStateOfMovieSequence, 0xff9b0434)
+
+NSTUB(eventproc_ZoomCon_ShowState, 0xff9b2e50)
+
+NSTUB(eventproc_export_StartSwitchViewFinder, 0xff9bd408)
+NSTUB(eventproc_export_StopSwitchViewFinder, 0xff9bd45c)
+NSTUB(eventproc_export_SwitchViewFinder, 0xff9bd488)
+
+NSTUB(eventproc_export_UiComIF_SendEventToUI, 0xff9becd4)
+
+NSTUB(eventproc_DeletePlayMyColController, 0xff9fcb88)
+
+NSTUB(eventproc_TerminateDpofUI, 0xffa0ae08)
+
+NSTUB(eventproc_StartPrintOrderMenu, 0xffa0bf50)
+
+NSTUB(eventproc_StartDpofPlayLoading, 0xffa104c8)
+
+NSTUB(eventproc_SyncStopDpofPlayLoading, 0xffa106ac)
+
+NSTUB(eventproc_StartTransferOrderMenu, 0xffa10d24)
+
+NSTUB(eventproc_StartPlayModeMenu, 0xffa13d40)
+
+NSTUB(eventproc_StartRecModeMenu, 0xffa13e14)
+NSTUB(eventproc_ShutdownRecModeMenu, 0xffa13ed8)
+
+NSTUB(eventproc_ShutdownPlayModeMenu, 0xffa14060)
+NSTUB(eventproc_ShutdownPlayModeMenuWithoutPbRedraw, 0xffa1410c)
+
+NSTUB(eventproc_InstallRecMenu, 0xffa16158)
+
+NSTUB(eventproc_InstallPlayMenu, 0xffa18844)
+
+NSTUB(eventproc_InstallSetupMenu, 0xffa1adfc)
+
+NSTUB(eventproc_InstallMyCameraMenu, 0xffa1debc)
+
+NSTUB(eventproc_IsCalledStopEVF, 0xffa1ef1c)
+
+NSTUB(eventproc_ShutdownRecAllMenu, 0xffa1f6e8)
+NSTUB(eventproc_ShutdownPlayAllMenu, 0xffa1f760)
+
+NSTUB(eventproc_export_StartFirmInfoMenu, 0xffa265bc)
+
+NSTUB(eventproc_SaveLanguageNameList, 0xffa29474)
+NSTUB(eventproc_RegisterLanguageName, 0xffa29478)
+
+NSTUB(eventproc_CreateLanguageMenu, 0xffa2a034)
+NSTUB(eventproc_DeleteLanguageMenu, 0xffa2a1dc)
+
+NSTUB(eventproc_export_FmtMenu_ExecuteQuickFormat, 0xffa2c628)
+
+NSTUB(eventproc_export_StartDirectTransferManager, 0xffa31c4c)
+
+NSTUB(eventproc_export_StartDtConfirmMenu, 0xffa3242c)
+NSTUB(eventproc_export_StoptDtConfirmMenu, 0xffa3251c)
+
+NSTUB(eventproc_export_StoptDtExecuteMenu, 0xffa32f88)
+
+NSTUB(eventproc_StartDpConnect, 0xffa36650)
+
+NSTUB(eventproc_StopDpConnect, 0xffa368d8)
+
+NSTUB(eventproc_CreateDpConnectController, 0xffa36c78)
+NSTUB(eventproc_DeleteDpConnectController, 0xffa36f08)
+NSTUB(eventproc_shutdownDirectPrintUI, 0xffa36fdc)
+
+NSTUB(eventproc_StartDpDpofMenu, 0xffa38b2c)
+
+NSTUB(eventproc_StartDpMainMenu, 0xffa3ebc4)
+
+NSTUB(eventproc_StartDpPrinting, 0xffa407b8)
+
+NSTUB(eventproc_StartDpsDpofMenu, 0xffa41ca4)
+
+NSTUB(eventproc_StartDpsMainMenu, 0xffa47ec8)
+
+NSTUB(eventproc_StartDpsStop, 0xffa4e3b8)
+
+NSTUB(eventproc_StartDpStopReconfirm, 0xffa4f6e4)
+
+NSTUB(eventproc_StartDpStyleMenu, 0xffa51978)
+
+NSTUB(eventproc_StartDpTrimming, 0xffa55af8)
+
+NSTUB(eventproc_DBG_changeTraceLevel, 0xffa579d4)
+
+NSTUB(eventproc_ControlViewEvent, 0xffa5f30c)
+
+NSTUB(eventproc_InstallPrintMenu, 0xffa6b864)
+
+NSTUB(eventproc_DisableNotificationPTP, 0xffa71e10)
+NSTUB(eventproc_EnableNotificationPTP, 0xffa71e24)
+NSTUB(eventproc_SetUSBToPTPMode, 0xffa71e3c)
+NSTUB(eventproc_SetUSBToDCPMode, 0xffa71e50)
+NSTUB(eventproc_RefreshUSBMode, 0xffa71e68)
+NSTUB(eventproc_NotifyConnectPictBridge, 0xffa71eec)
+NSTUB(eventproc_NotifyDisconnectPictBridge, 0xffa71f0c)
+
+NSTUB(eventproc_PTPRspnd_StartUpPTPFrameworkClient, 0xffa89aa4)
+NSTUB(eventproc_PTPRspnd_ShutDownPTPFrameworkClient, 0xffa89b4c)
+
+NSTUB(eventproc_PTPRspnd_ResetTable, 0xffa933ac)
+NSTUB(eventproc_PTPRspnd_EnableGetTreeInfo, 0xffa933b8)
+NSTUB(eventproc_PTPRspnd_EnableStorage, 0xffa933f8)
+
+NSTUB(eventproc_PTPRspnd_ShowRemoteStg, 0xffa93760)
+
+NSTUB(eventproc_InitializeDCPClassFunctions, 0xffaa4970)
+
+NSTUB(eventproc_TerminateDCPClassFunctions, 0xffaa5e04)
+
+NSTUB(eventproc_CreateVcomUart, 0xffaa73ac)
+NSTUB(eventproc_DeleteVcomUart, 0xffaa74dc)
+
+NSTUB(eventproc_RegComEventProc, 0xffaa7ef4)
+
+NSTUB(eventproc_MechaReset, 0xffaa80c0)
+NSTUB(eventproc_MechaTerminate, 0xffaa80f8)
+NSTUB(eventproc_ShowMechaMacro, 0xffaa8158)
+
+NSTUB(eventproc_EnableMechaCircuit, 0xffaab4dc)
+NSTUB(eventproc_DisableMechaCircuit, 0xffaab4ec)
+NSTUB(eventproc_EnableFocusPiCircuit, 0xffaab4fc)
+NSTUB(eventproc_DisableFocusPiCircuit, 0xffaab50c)
+NSTUB(eventproc_GetFocusPiSensorLevel, 0xffaab51c)
+
+NSTUB(eventproc_EnableZoomPiCircuit, 0xffaab534)
+NSTUB(eventproc_DisableZoomPiCircuit, 0xffaab544)
+NSTUB(eventproc_GetZoomPiSensorLevel, 0xffaab554)
+
+NSTUB(eventproc_EnableZoomEncoderCircuit, 0xffaab56c)
+NSTUB(eventproc_DisableZoomEncoderCircuit, 0xffaab57c)
+NSTUB(eventproc_SendMechaCircuitData, 0xffaab58c)
+NSTUB(eventproc_ReceiveMechaCircuitDataAll, 0xffaab5cc)
+
+NSTUB(eventproc_MoveLensToFirstPointEvent, 0xffaae118)
+NSTUB(eventproc_MoveLensToTerminatePointEvent, 0xffaae190)
+NSTUB(eventproc_PermitLensControllerFocusReset, 0xffaae1e0)
+NSTUB(eventproc_PermitLensControllerFocusInfinity, 0xffaae1f0)
+NSTUB(eventproc_IsLensOutside, 0xffaae200)
+NSTUB(eventproc_GetLensErrorStatus, 0xffaae20c)
+
+NSTUB(eventproc_ResetZoomLens, 0xffaaf7d0)
+NSTUB(eventproc_ResetZoomLensToFirstPoint, 0xffaaf800)
+NSTUB(eventproc_ResetZoomLensToTermiantePoint, 0xffaaf874)
+NSTUB(eventproc_MoveZoomLensWithPoint, 0xffaaf8e8)
+NSTUB(eventproc_MoveZoomLensWithPosition, 0xffaaf964)
+NSTUB(eventproc_MoveZoomLensToTerminatePosition, 0xffaaf9b8)
+NSTUB(eventproc_GetZoomLensCurrentPoint, 0xffaafa08)
+NSTUB(eventproc_GetZoomLensCurrentPosition, 0xffaafa1c)
+NSTUB(eventproc_GetZoomLensTelePoint, 0xffaafa30)
+
+NSTUB(eventproc_SetZoomLensNormalControlGain, 0xffab10dc)
+
+NSTUB(eventproc_SetZoomLensResetControlGain, 0xffab29b4)
+
+NSTUB(eventproc_MoveZoomActuator, 0xffab545c)
+NSTUB(eventproc_SetZoomActuatorSpeedPPS, 0xffab54a8)
+NSTUB(eventproc_GetZoomActuatorSpeedPPS, 0xffab54bc)
+NSTUB(eventproc_SetZoomActuatorSpeedControlGain, 0xffab54d0)
+NSTUB(eventproc_GetZoomActuatorSpeedControlGain, 0xffab54e4)
+NSTUB(eventproc_SetZoomActuatorLimitAmpere, 0xffab54f8)
+NSTUB(eventproc_GetZoomActuatorLimitAmpere, 0xffab550c)
+NSTUB(eventproc_SetZoomActuatorPwmDuty, 0xffab5520)
+NSTUB(eventproc_SetZoomActuatorPwmFixedTime, 0xffab5534)
+NSTUB(eventproc_GetZoomActuatorCurrentPosition, 0xffab5548)
+NSTUB(eventproc_IsZoomActuatorResetSensorPlusSide, 0xffab5594)
+NSTUB(eventproc_SetDCMotorSpeedLevel, 0xffab55a0)
+NSTUB(eventproc_SetDCMotorChargePump, 0xffab55b4)
+NSTUB(eventproc_SetDCMotorPwmFixedTimeLevel, 0xffab55c8)
+NSTUB(eventproc_SetDCMotorPwmLevel, 0xffab55dc)
+NSTUB(eventproc_SetPM3ByGpio, 0xffab55f0)
+NSTUB(eventproc_ClearPM3ByGpio, 0xffab5600)
+NSTUB(eventproc_ClearPM3ByFs, 0xffab5610)
+NSTUB(eventproc_MoveDCMotorCW, 0xffab5620)
+NSTUB(eventproc_MoveDCMotorCCW, 0xffab567c)
+NSTUB(eventproc_StopDCMotor, 0xffab56d8)
+NSTUB(eventproc_SetDCMotorWaitTime, 0xffab56f8)
+NSTUB(eventproc_GetCurrentEncoderPosition, 0xffab5710)
+
+NSTUB(eventproc_ResetIrisEvent, 0xffab6838)
+NSTUB(eventproc_MoveIrisWithAvEvent, 0xffab6868)
+NSTUB(eventproc_MoveIrisToTerminatePositionEvent, 0xffab689c)
+NSTUB(eventproc_GetIrisAvEvent, 0xffab68a4)
+NSTUB(eventproc_MoveIrisWithAvWithoutBacklashEvent, 0xffab68b8)
+
+NSTUB(eventproc_CloseMechaShutterEvent, 0xffab7bf4)
+NSTUB(eventproc_OpenMechaShutterEvent, 0xffab7c24)
+NSTUB(eventproc_CloseMechaShutterWithTimingEvent, 0xffab7c54)
+NSTUB(eventproc_SetMechaShutterDacSettingEvent, 0xffab7c98)
+NSTUB(eventproc_SetMechaShutterOpenDacSettingEvent, 0xffab7cac)
+NSTUB(eventproc_SetMechaShutterFinalDacSettingEvent, 0xffab7cc0)
+NSTUB(eventproc_SetMechaShutterOpenFinalDacSettingEvent, 0xffab7cd4)
+NSTUB(eventproc_SetMechaShutterWaitTimeSettingEvent, 0xffab7ce8)
+NSTUB(eventproc_GetMechaShutterStatusEvent, 0xffab7cfc)
+NSTUB(eventproc_SaveMechaShutterCount, 0xffab7d08)
+NSTUB(eventproc_GetMechaShutterCount, 0xffab7d44)
+NSTUB(eventproc_ClearMechaShutterCount, 0xffab7d94)
+
+NSTUB(eventproc_TurnOnNdFilterEvent, 0xffab8668)
+NSTUB(eventproc_TurnOffNdFilterEvent, 0xffab8698)
+NSTUB(eventproc_SetNdFilterDacSettingEvent, 0xffab86c8)
+
+NSTUB(eventproc_MoveFocusLensWithDistance, 0xffac00b0)
+NSTUB(eventproc_ResetFocusLens, 0xffac017c)
+NSTUB(eventproc_MoveFocusLensToTerminate, 0xffac01dc)
+NSTUB(eventproc_MoveFocusLensWithPosition, 0xffac0250)
+NSTUB(eventproc_MoveFocusLensWithPositionWithoutBacklash, 0xffac0320)
+NSTUB(eventproc_MoveFocusActuator, 0xffac03f0)
+NSTUB(eventproc_GetFocusLensCurrentPosition, 0xffac04ac)
+NSTUB(eventproc_GetFocusLensResetPosition, 0xffac04c0)
+NSTUB(eventproc_GetFocusLensResetPositionForInside, 0xffac04d4)
+NSTUB(eventproc_GetFocusLensResetPositionForOutside, 0xffac04e8)
+NSTUB(eventproc_GetFocusLensResetDefaultPosition, 0xffac04fc)
+NSTUB(eventproc_SetFocusLensDefaultCondition, 0xffac0510)
+NSTUB(eventproc_SetFocusLensCondition, 0xffac0528)
+NSTUB(eventproc_GetFocusLensMoveCompleteTime, 0xffac061c)
+NSTUB(eventproc_GetFocusLensNdCoefficientPulse, 0xffac0628)
+NSTUB(eventproc_GetFocusLensSettingMaxSpeed, 0xffac063c)
+NSTUB(eventproc_GetFocusLensSettingMaxSpeedByDeltaType, 0xffac0650)
+NSTUB(eventproc_SetFocusLensMaxSpeedLimit, 0xffac0664)
+NSTUB(eventproc_CancelFocusLensMaxSpeedLimit, 0xffac067c)
+NSTUB(eventproc_EscapeFocusLens, 0xffac0690)
+NSTUB(eventproc_GetFocusLensSubjectDistance, 0xffac0724)
+NSTUB(eventproc_GetFocusLensSubjectDistanceFromLens, 0xffac0748)
+NSTUB(eventproc_EnableFocusLens, 0xffac076c)
+NSTUB(eventproc_SetFocusLensBacklashSpeedToMax, 0xffac07d0)
+NSTUB(eventproc_ClearFocusLensBacklashSpeedToMax, 0xffac07e0)
+NSTUB(eventproc_CheckFocusLensAfAging, 0xffac0880)
+
+NSTUB(eventproc_MoveCZToPointEvent, 0xffac2800)
+
+NSTUB(eventproc_TurnOnAFLampEvent, 0xffac2a94)
+NSTUB(eventproc_TurnOffAFLampEvent, 0xffac2aac)
+
+NSTUB(eventproc_DisplayFactoryMode, 0xffac2b9c)
+NSTUB(eventproc_UndisplayFactoryMode, 0xffac2bb4)
+
+NSTUB(eventproc_ClearFactoryMode, 0xffac2ef8)
+NSTUB(eventproc_SetFactoryMode, 0xffac2f28)
+
+NSTUB(eventproc_IsFactoryMode, 0xffac2fe8)
+NSTUB(eventproc_StartFactoryModeController, 0xffac303c)
+
+NSTUB(eventproc_EraseAdjustmentArea, 0xffac39b8)
+NSTUB(eventproc_DumpAdjArea, 0xffac39d8)
+NSTUB(eventproc_DumpAdjMirror, 0xffac3a00)
+
+NSTUB(eventproc_GetAdjTableVersion, 0xffac3a58)
+NSTUB(eventproc_GetAdjTableMapVersion, 0xffac3aa0)
+NSTUB(eventproc_GetAdjTableValueVersion, 0xffac3ab0)
+NSTUB(eventproc_ShowDefaultAdjTableVersion, 0xffac3af4)
+NSTUB(eventproc_LoadAdjustmentTable, 0xffac3b28)
+NSTUB(eventproc_SaveAdjustmentTable, 0xffac3b40)
+NSTUB(eventproc_SaveAdjustmentValue, 0xffac3b5c)
+NSTUB(eventproc_LoadAdjustmentValue, 0xffac3b8c)
+NSTUB(eventproc_PrintAdjTableMap, 0xffac3cc8)
+NSTUB(eventproc_CreateAdjustmentTableMirror, 0xffac3f8c)
+
+NSTUB(eventproc_WRITEADJTABLETOFROM, 0xffac4278)
+NSTUB(eventproc_AddAdjDataToFRom, 0xffac42ac)
+
+NSTUB(eventproc_LoadParamDataFromAdjTableBin, 0xffac592c)
+NSTUB(eventproc_LoadDataFromAdjTableBin, 0xffac5a5c)
+
+NSTUB(eventproc_FA_Create, 0xffac5bf8)
+NSTUB(eventproc_FA_Delete, 0xffac5c2c)
+
+NSTUB(eventproc_PrintFirmVersion, 0xffac5d98)
+NSTUB(eventproc_PrintFaexeVersioin, 0xffac5de8)
+NSTUB(eventproc_CreateFADBGSingalID, 0xffac5dfc)
+NSTUB(eventproc_FADBGSingal, 0xffac5e14)
+
+NSTUB(eventproc_FADBGPrintf, 0xffac5efc)
+
+NSTUB(eventproc_FAPrintf, 0xffac6090)
+
+NSTUB(eventproc_OutputLogToFile, 0xffac61ac)
+NSTUB(eventproc_StopLogOut, 0xffac62e8)
+
+NSTUB(eventproc_GetLogData, 0xffac6528)
+NSTUB(eventproc_ActivateAdjLog, 0xffac6618)
+NSTUB(eventproc_InactivateAdjLog, 0xffac6638)
+NSTUB(eventproc_StartLogOut, 0xffac6658)
+NSTUB(eventproc_IsLogOutType, 0xffac6674)
+
+NSTUB(eventproc_InitializeAdjustmentSystem, 0xffac679c)
+NSTUB(eventproc_TerminateAdjustmentSystem, 0xffac67e4)
+NSTUB(eventproc_InitializeAdjustmentFunction, 0xffac682c)
+
+NSTUB(eventproc_PrintAllAEIntegData, 0xffac6aec)
+
+NSTUB(eventproc_GetAEIntegralValue, 0xffac7934)
+NSTUB(eventproc_GETMAINFLASHEVALUATIONVALUE, 0xffac79e0)
+NSTUB(eventproc_GETPREFLASHEVALUATIONVALUE, 0xffac7a94)
+NSTUB(eventproc_GETALTERNATEEVALUATIONVALUEWITHMECHASHUTTER, 0xffac7b50)
+NSTUB(eventproc_GETEVFEVALUATIONVALUEWITHMECHASHUTTER, 0xffac7bf4)
+NSTUB(eventproc_GETCRWEVALUATIONVALUEWITHMECHASHUTTER, 0xffac7c98)
+NSTUB(eventproc_GETCRWEVALUATIONVALUEWITHOUTMECHASHUTTER, 0xffac7d3c)
+NSTUB(eventproc_GETEVFEVALUATIONVALUEWITHOUTMECHASHUTTER, 0xffac7de0)
+NSTUB(eventproc_GETMOVIEEVALUATIONVALUEWITHMECHASHUTTER, 0xffac7e84)
+NSTUB(eventproc_AbortAEIntegralValue, 0xffac7f28)
+NSTUB(eventproc_SetAEIntegStrobeProperty, 0xffac7f88)
+NSTUB(eventproc_SetAEIntegralValueProperty, 0xffac7fc4)
+
+NSTUB(eventproc_GetAEIntegralValueWithFix, 0xffac81ec)
+
+NSTUB(eventproc_GetAllAEIntegralAllValueWithFix, 0xffac835c)
+
+NSTUB(eventproc_SetWhiteCoefficient, 0xffac84cc)
+
+NSTUB(eventproc_SetAEIntegWindowsMode, 0xffac8594)
+
+NSTUB(eventproc_SetAEIntegValueBit, 0xffac8654)
+NSTUB(eventproc_GetAEIntegralServiceMode, 0xffac8674)
+NSTUB(eventproc_StopAEIntegralService, 0xffac869c)
+NSTUB(eventproc_StartAEIntegralService, 0xffac8794)
+
+NSTUB(eventproc_SetLineDefMarkThroughMode, 0xffac8ad0)
+NSTUB(eventproc_SetAEIntegAverageOBData, 0xffac8b70)
+
+NSTUB(eventproc_SetDeltaCDSGain, 0xffaca278)
+NSTUB(eventproc_ReloadCdsAdjustment, 0xffaca2c8)
+NSTUB(eventproc_GetObClampValue, 0xffaca2e0)
+NSTUB(eventproc_SetObClamp, 0xffaca310)
+
+NSTUB(eventproc_GetCdsGainValue, 0xffaca364)
+NSTUB(eventproc_SetCDSGain, 0xffaca39c)
+
+NSTUB(eventproc_SetCDSGainStep, 0xffaca3e4)
+
+NSTUB(eventproc_SetAdjCdsMode, 0xffaca440)
+NSTUB(eventproc_CancelAdjCdsMode, 0xffaca45c)
+NSTUB(eventproc_IsAdjCdsMode, 0xffaca478)
+
+NSTUB(eventproc_ConvertTvToExposureTime, 0xffaca59c)
+NSTUB(eventproc_GetCurrentExposureTime, 0xffaca5d8)
+NSTUB(eventproc_GetCurrentShutterSpeed, 0xffaca5f0)
+NSTUB(eventproc_SetShutterSpeedWithMecha, 0xffaca604)
+
+NSTUB(eventproc_SetShutterSpeed, 0xffaca678)
+
+NSTUB(eventproc_GetUserSetShutterSPeed, 0xffaca720)
+NSTUB(eventproc_GetShutterSpeedRegularMaxLimit, 0xffaca730)
+NSTUB(eventproc_GetShutterSpeedRegularMinLimit, 0xffaca754)
+
+NSTUB(eventproc_MoveIrisToAv, 0xffaca8c8)
+
+NSTUB(eventproc_ReloadIrisAdjustment, 0xffaca934)
+NSTUB(eventproc_GetCurrentAvValue, 0xffaca940)
+
+NSTUB(eventproc_ReloadNdFilterAdjustment, 0xffacaa9c)
+NSTUB(eventproc_PutInNdFilter, 0xffacaac4)
+
+NSTUB(eventproc_PutOutNdFilter, 0xffacab0c)
+
+NSTUB(eventproc_CloseMShutter, 0xffacac18)
+
+NSTUB(eventproc_OpenMShutter, 0xffacac60)
+
+NSTUB(eventproc_CalculateLog2ToApex, 0xffacb6e0)
+
+NSTUB(eventproc_CalculatePow2FromApex, 0xffacb714)
+NSTUB(eventproc_CalcLog10, 0xffacb738)
+
+NSTUB(eventproc_ConvertApexToApexStd, 0xffacb7d0)
+NSTUB(eventproc_ConvertApexStdToApex, 0xffacb804)
+
+NSTUB(eventproc_OneShotWhigeBalance, 0xffacba04)
+
+NSTUB(eventproc_SetWBYlStandardWidth, 0xffacba84)
+NSTUB(eventproc_SetReferenceWBGainForCalibration, 0xffacbac8)
+NSTUB(eventproc_SetToolCorrectCoefficient, 0xffacbaf8)
+
+NSTUB(eventproc_ReloadWBAdjustment, 0xffacbb80)
+
+NSTUB(eventproc_ConvertCxCyToWBGain, 0xffacbe44)
+
+NSTUB(eventproc_GetCurrentZoomLensDirection, 0xffacbfc4)
+NSTUB(eventproc_GetZoomLensResetPlus, 0xffacbfe4)
+NSTUB(eventproc_MoveZoomLensToMechaEnd, 0xffacc00c)
+
+NSTUB(eventproc_MoveZoomLensToPositionByManual, 0xffacc0ec)
+
+NSTUB(eventproc_ResetZoomToAdjTerminatePoint, 0xffacc3cc)
+
+NSTUB(eventproc_ResetZoomToAdjFirstPoint, 0xffacc4b4)
+
+NSTUB(eventproc_GetCurrentZoomLensPoint, 0xffacc57c)
+NSTUB(eventproc_GetCurrentZoomLensPosition, 0xffacc590)
+NSTUB(eventproc_MoveZoomLensToPoint, 0xffacc5a4)
+
+NSTUB(eventproc_MoveZoomLensToPosition, 0xffacc5fc)
+
+NSTUB(eventproc_ResetZoomToTerminatePoint, 0xffacc654)
+
+NSTUB(eventproc_ResetZoomToFirstPoint, 0xffacc69c)
+
+NSTUB(eventproc_ResetZoom, 0xffacc6e4)
+NSTUB(eventproc_ReloadZoomAdjustment, 0xffacc72c)
+NSTUB(eventproc_GetZoomLensCurrent, 0xffacc738)
+NSTUB(eventproc_GetZoomLensSpeed, 0xffacc74c)
+
+NSTUB(eventproc_ConvertToPositionWithDistanceAndZoomPoint, 0xffacc9d8)
+
+NSTUB(eventproc_ReloadFocusLensAdjustment, 0xffacca1c)
+NSTUB(eventproc_GetFocusDefaultResetPosition, 0xffacca28)
+NSTUB(eventproc_GetFocusResetPosition, 0xffacca3c)
+NSTUB(eventproc_GetCurrentTargetDistance, 0xffacca50)
+
+NSTUB(eventproc_GetCurrentFocusLensPosition, 0xffaccaa8)
+NSTUB(eventproc_MoveFocusLensToTerminatePosition, 0xffaccabc)
+
+NSTUB(eventproc_MoveFocusLensToPositionWithMaxSpeed, 0xffaccb4c)
+
+NSTUB(eventproc_MoveFocusLensToPosition, 0xffaccbb0)
+
+NSTUB(eventproc_MoveFocusLensToDistance, 0xffacccf0)
+
+NSTUB(eventproc_ResetFocus, 0xffacce0c)
+
+NSTUB(eventproc_PrintScanTable, 0xffacd1d4)
+NSTUB(eventproc_PrintMultiWinScanTable, 0xffacd338)
+
+NSTUB(eventproc_CalculatePeakPositionByLeastSquare, 0xfface860)
+
+NSTUB(eventproc_SetFocusScanAutoStopProperty, 0xffaced24)
+NSTUB(eventproc_StartFocusScanWithAutoStopFix, 0xffaced4c)
+
+NSTUB(eventproc_StartFocusScanWithAutoStop, 0xffacee28)
+
+NSTUB(eventproc_StopFocusScan, 0xffaceff0)
+NSTUB(eventproc_StartFocusScanWithEnableToStop, 0xffaceffc)
+
+NSTUB(eventproc_StartFocusScanWithRange, 0xffacf1a8)
+
+NSTUB(eventproc_StartFocusScan, 0xffacf2f0)
+
+NSTUB(eventproc_StartMultiWinFocusScan, 0xffacf454)
+
+NSTUB(eventproc_StartDigiconService, 0xffacf5d8)
+
+NSTUB(eventproc_GetDigiconData, 0xffacf658)
+
+NSTUB(eventproc_StartDigiconFocusScan, 0xffacfc60)
+NSTUB(eventproc_StopDigiconService, 0xffacfcd0)
+NSTUB(eventproc_SetMultiWinPos, 0xffacfcfc)
+NSTUB(eventproc_SetAFSensorDriveMode, 0xffacfd68)
+NSTUB(eventproc_GetAFSensorDriveMode, 0xffacfe0c)
+NSTUB(eventproc_SetBPFForBestPintCorrect, 0xffacfe1c)
+NSTUB(eventproc_CancelBPFForBestPintCorrect, 0xffacfe30)
+NSTUB(eventproc_ReloadBPCoeffAdjustment, 0xffacfe3c)
+
+NSTUB(eventproc_ReloadEfAdjustment, 0xffad00f8)
+NSTUB(eventproc_ChargeStrobe, 0xffad0104)
+
+NSTUB(eventproc_ReloadColorAdjustment, 0xffad0200)
+
+NSTUB(eventproc_RegistColorMatrix, 0xffad02f0)
+NSTUB(eventproc_UnregistColorMatrix, 0xffad0334)
+
+NSTUB(eventproc_ShowCurrentExp, 0xffad0500)
+
+NSTUB(eventproc_SetAE_ShutterSpeed, 0xffad0598)
+
+NSTUB(eventproc_FocusAEWithCompensation, 0xffad06fc)
+
+NSTUB(eventproc_SetAE_CdsGainValue, 0xffad07f0)
+NSTUB(eventproc_FixAEWithCompensation, 0xffad0808)
+
+NSTUB(eventproc_SetAdj_AEMode, 0xffad08a4)
+
+NSTUB(eventproc_CancelAdj_AEMode, 0xffad08f4)
+NSTUB(eventproc_PreFixAE, 0xffad0924)
+
+NSTUB(eventproc_AfAEWithAperturePriority, 0xffad09a0)
+
+NSTUB(eventproc_AdjAEWithAperturePriority, 0xffad0a7c)
+
+NSTUB(eventproc_SleepAE, 0xffad0c0c)
+
+NSTUB(eventproc_AfAEWithCompensation, 0xffad0c54)
+
+NSTUB(eventproc_SwitchOffDisplay, 0xffad0ff0)
+NSTUB(eventproc_SwitchOnDisplay, 0xffad1024)
+NSTUB(eventproc_GetVideoOutType, 0xffad105c)
+NSTUB(eventproc_SetVideoOutType, 0xffad106c)
+
+NSTUB(eventproc_IsEVFDrive, 0xffad109c)
+NSTUB(eventproc_StopEVFDrive, 0xffad10fc)
+NSTUB(eventproc_StartEVFDriveWithMode, 0xffad114c)
+NSTUB(eventproc_StartEVFDrive, 0xffad1198)
+
+NSTUB(eventproc_IsEvfDriveMode, 0xffad1474)
+
+NSTUB(eventproc_GetVRAMHPixelsSize, 0xffad1778)
+NSTUB(eventproc_GetVRAMVPixelsSize, 0xffad1784)
+NSTUB(eventproc_StopContinuousVRAMData, 0xffad1790)
+
+NSTUB(eventproc_GetContinuousVRAMData, 0xffad1854)
+
+NSTUB(eventproc_GetPixelsOfViewangle, 0xffad1f84)
+
+NSTUB(eventproc_GetModelId, 0xffad26cc)
+NSTUB(eventproc_SetInputVoltage, 0xffad26d4)
+NSTUB(eventproc_SaveBatSenseOffsetAdjustmentTable, 0xffad26e8)
+NSTUB(eventproc_SetImageMode, 0xffad26f8)
+NSTUB(eventproc_SetDate, 0xffad2710)
+NSTUB(eventproc_SetYear, 0xffad2804)
+NSTUB(eventproc_SetMonth, 0xffad286c)
+NSTUB(eventproc_SetDay, 0xffad28d0)
+NSTUB(eventproc_SetHour, 0xffad2940)
+NSTUB(eventproc_SetMinute, 0xffad29ac)
+NSTUB(eventproc_SetSecond, 0xffad2a1c)
+NSTUB(eventproc_GetYear, 0xffad2a88)
+NSTUB(eventproc_GetMonth, 0xffad2ac0)
+NSTUB(eventproc_GetDay, 0xffad2af8)
+NSTUB(eventproc_GetHour, 0xffad2b28)
+NSTUB(eventproc_GetMinute, 0xffad2b58)
+NSTUB(eventproc_GetSecond, 0xffad2b88)
+NSTUB(eventproc_SetLangMenuType, 0xffad2bb8)
+
+NSTUB(eventproc_GetUnpackCrwIntegralValue, 0xffad3308)
+
+NSTUB(eventproc_ShowTransparentMemory, 0xffad4fb4)
+NSTUB(eventproc_DumpTransparentMemoryItem, 0xffad4fe4)
+NSTUB(eventproc_AddTransparentMemory, 0xffad5038)
+NSTUB(eventproc_AttachToTransparentMemory, 0xffad5080)
+NSTUB(eventproc_RemoveTransparentMemory, 0xffad50c8)
+NSTUB(eventproc_GetTransparentMemorySize, 0xffad50ec)
+NSTUB(eventproc_GetTransparentMemory, 0xffad510c)
+NSTUB(eventproc_GetTransparentMemoryPosition, 0xffad5164)
+
+NSTUB(eventproc_CompletePrepareTestRec, 0xffad8294)
+NSTUB(eventproc_StrobeChargeCompForTestRec, 0xffad82b0)
+
+NSTUB(eventproc_InitializeTestRec, 0xffad83bc)
+NSTUB(eventproc_TerminateTestRec, 0xffad8428)
+
+NSTUB(eventproc_ExecuteTestRec, 0xffad85e0)
+NSTUB(eventproc_ExecuteTestRecCF, 0xffad8764)
+
+NSTUB(eventproc_SetDefaultRecParameter, 0xffada65c)
+NSTUB(eventproc_SetDefectRecParameter, 0xffada8d8)
+
+NSTUB(eventproc_EnableDebugLogMode, 0xffada92c)
+NSTUB(eventproc_DisableDebugLogMode, 0xffada944)
+
+NSTUB(eventproc_FreeBufferForSoundRec, 0xffadaf48)
+
+NSTUB(eventproc_StartSoundRecord, 0xffadb080)
+
+NSTUB(eventproc_StartSoundPlay, 0xffadb2dc)
+NSTUB(eventproc_InitializeSoundRec, 0xffadb304)
+NSTUB(eventproc_TerminateSoundRec, 0xffadb344)
+
+NSTUB(eventproc_MakeBootDisk, 0xffaf5580)
+NSTUB(eventproc_MakeScriptDisk, 0xffaf5594)
+
+NSTUB(eventproc_LoadScript, 0xffaf6fe8)
+NSTUB(eventproc_UnLoadScript, 0xffaf6ff8)
+NSTUB(eventproc_Printf, 0xffaf700c)
+NSTUB(eventproc_ScriptDisEnabled, 0xffaf7024)
+NSTUB(eventproc_ScriptEnabled, 0xffaf7038)
+
+NSTUB(eventproc_GetLogToFile, 0xffaff378)
+
+NSTUB(eventproc_MemoryChecker, 0xffb006fc)
+NSTUB(eventproc_VerifyByte, 0xffb0082c)
+
Index: /trunk/platform/ixus65_sd630/sub/100a/capt_seq.c
===================================================================
--- /trunk/platform/ixus65_sd630/sub/100a/capt_seq.c	(revision 511)
+++ /trunk/platform/ixus65_sd630/sub/100a/capt_seq.c	(revision 511)
@@ -0,0 +1,279 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+#define RAWDATA_AVAILABLE (1)
+#define RAWDATA_SAVED (2)
+
+#define NR_ON (2)
+#define NR_OFF (1)
+
+static long raw_save_stage;
+
+void capt_seq_hook_raw_here()
+{
+    raw_save_stage = RAWDATA_AVAILABLE;
+    core_rawdata_available();
+    while (raw_save_stage != RAWDATA_SAVED){
+	_SleepTask(10);
+    }
+}
+
+void hook_raw_save_complete()
+{
+    raw_save_stage = RAWDATA_SAVED;
+}
+
+
+void capt_seq_hook_set_nr()
+{
+    long *nrflag = (long*)0x61F4;
+
+    switch (core_get_noise_reduction_value()){
+    case NOISE_REDUCTION_AUTO_CANON:
+	// leave it alone
+	break;
+    case NOISE_REDUCTION_OFF:
+	*nrflag = 1;
+	break;
+    case NOISE_REDUCTION_ON:
+	*nrflag = 2;
+	break;
+    };
+}
+
+void __attribute__((naked,noinline)) sub_FF963344_my(long p)
+{
+#if 1
+    asm volatile (
+                "STMFD   SP!, {R4-R6,LR}\n"
+                "LDR     R3, =0x6F3BC\n"
+                "LDR     R5, =0x61F0\n"
+                "SUB     SP, SP, #4\n"
+                "MVN     R1, #0\n"
+                "STR     R0, [R5]\n"
+                "LDR     R0, [R3]\n"
+                "BL      sub_FF81FF04\n"
+                "LDR     R3, =0x99EC0\n"
+                "LDR     R0, [R3,#0x7C]\n"
+                "BL      sub_FF89EFF0\n"
+                "BL      sub_FF963298\n"
+          //    "BL      wait_until_remote_button_is_released\n"
+	    	"BL      capt_seq_hook_set_nr\n"
+                "LDR     R3, =0x61F8\n"
+                "LDR     R0, [R3]\n"
+                "BL      sub_FF89F4B0\n"
+
+		"B	 sub_FF963380\n"
+    );
+#endif
+}
+
+void __attribute__((naked,noinline)) sub_FF95FEA0_my(long p)
+{
+    asm volatile (
+                 "STMFD   SP!, {R4,LR}\n"
+                 "LDR     R4, [R0,#0xC]\n"
+                 "BL      sub_FF968658\n"
+                 "CMP     R0, #0\n"
+                 "BNE     loc_FF95FEB8\n"
+                 "BL      sub_FF968664\n"
+ "loc_FF95FEB8:\n"
+                 "LDR     R3, =0x99EC0\n"
+                 "LDR     R2, [R3,#0x24]\n"
+                 "CMP     R2, #0\n"
+                 "BNE     loc_FF95FEEC\n"
+                 "MOV     R0, #0xC\n"
+                 "BL      sub_FF968678\n"
+                 "TST     R0, #1\n"
+                 "BEQ     loc_FF95FEEC\n"
+                 "MOV     R0, #1\n"
+ "loc_FF95FEDC:\n"
+                 "MOV     R2, R4\n"
+                 "MOV     R1, #1\n"
+                 "LDMFD   SP!, {R4,LR}\n"
+                 "B       sub_FF95E574\n"
+ "loc_FF95FEEC:\n"
+                 "LDR     R3, =0x99EC0\n"
+                 "LDR     R2, [R3,#0x24]\n"
+                 "CMP     R2, #0\n"
+                 "BNE     loc_FF95FF3C\n"
+                 "MOV     R0, R4\n"
+                 "BL      sub_FF962100\n"
+                 "TST     R0, #1\n"
+                 "BNE     loc_FF95FEDC\n"
+                 "BL      sub_FF9A15A8\n"
+                 "BL      sub_FF824ADC\n"
+                 "LDR     R2, =0x99E04\n"
+                 "ADD     R3, R4, R4,LSL#1\n"
+                 "STR     R0, [R2,R3,LSL#5]\n"
+                 "MOV     R0, R4\n"
+                 "BL      sub_FF963AB0\n"
+                 "BL      sub_FF962604\n"
+                 "BL      sub_FF9625A0\n"
+                 "MOV     R0, R4\n"
+                 "BL      sub_FF963344_my\n"  //------------->
+
+                 "BL      capt_seq_hook_raw_here\n"
+
+                 "B       loc_FF95FF50\n"
+ "loc_FF95FF3C:\n"
+                 "LDR     R3, =0x61E0\n"
+                 "LDR     R2, [R3]\n"
+                 "CMP     R2, #0\n"
+                 "MOVNE   R0, #0x1D\n"
+                 "MOVEQ   R0, #0\n"
+ "loc_FF95FF50:\n"
+                 "MOV     R2, R4\n"
+                 "MOV     R1, #1\n"
+                 "BL      sub_FF95E574\n"
+                 "LDMFD   SP!, {R4,LR}\n"
+                 "B       sub_FF96353C\n"
+    );
+}
+
+void __attribute__((naked,noinline)) capt_seq_task()
+{
+ asm volatile(
+                 "STMFD   SP!, {R4,LR}\n"
+                 "SUB     SP, SP, #4\n"
+                 "MOV     R4, SP\n"
+                 "B       loc_FF96048C\n"
+ "loc_FF960324:\n"
+                 "LDR     R2, [SP]\n"
+                 "LDR     R3, [R2]\n"
+                 "MOV     R0, R2\n"
+                 "CMP     R3, #0x14\n"
+                 "LDRLS   PC, [PC,R3,LSL#2]\n"
+                 "B       loc_FF960460\n"
+                 ".long loc_FF960390\n"
+                 ".long loc_FF9603B0\n"
+                 ".long loc_FF9603C4\n"
+                 ".long loc_FF9603D4\n"
+                 ".long loc_FF9603CC\n"
+                 ".long loc_FF9603DC\n"
+                 ".long loc_FF9603E4\n"
+                 ".long loc_FF9603F0\n"
+                 ".long loc_FF9603F8\n"
+                 ".long loc_FF960404\n"
+                 ".long loc_FF96040C\n"
+                 ".long loc_FF960414\n"
+                 ".long loc_FF96041C\n"
+                 ".long loc_FF960424\n"
+                 ".long loc_FF96042C\n"
+                 ".long loc_FF960438\n"
+                 ".long loc_FF960440\n"
+                 ".long loc_FF960448\n"
+                 ".long loc_FF960450\n"
+                 ".long loc_FF960458\n"
+                 ".long loc_FF960474\n"
+ "loc_FF960390:\n"
+                 "BL      sub_FF961D60\n"
+                 "BL      shooting_expo_param_override\n"   // +
+                 "BL      sub_FF95E090\n"
+                 "LDR     R3, =0x99EC0\n"
+                 "LDR     R2, [R3,#0x24]\n"
+                 "CMP     R2, #0\n"
+                 "BEQ     loc_FF960470\n"
+                 "BL      sub_FF95FF70\n"
+                 "B       loc_FF960470\n"
+ "loc_FF9603B0:\n"
+                 "BL      sub_FF95FEA0_my\n" //------------->
+ "loc_FF9603B4:\n"
+                 "LDR     R2, =0x99EC0\n"
+                 "MOV     R3, #0\n"
+                 "STR     R3, [R2,#0x24]\n"
+                 "B       loc_FF960470\n"
+ "loc_FF9603C4:\n"
+                 "BL      sub_FF9620F0\n"
+                 "B       loc_FF960470\n"
+ "loc_FF9603CC:\n"
+                 "BL      sub_FF960F60\n"
+                 "B       loc_FF9603B4\n"
+ "loc_FF9603D4:\n"
+                 "BL      sub_FF9612FC\n"
+                 "B       loc_FF9603B4\n"
+ "loc_FF9603DC:\n"
+                 "BL      sub_FF96130C\n"
+                 "B       loc_FF960470\n"
+ "loc_FF9603E4:\n"
+                 "BL      sub_FF961E44\n"
+                 "BL      sub_FF95E090\n"
+                 "B       loc_FF960470\n"
+ "loc_FF9603F0:\n"
+                 "BL      sub_FF960044\n"
+                 "B       loc_FF960470\n"
+ "loc_FF9603F8:\n"
+                 "BL      sub_FF961EAC\n"
+                 "BL      sub_FF95E090\n"
+                 "B       loc_FF960470\n"
+ "loc_FF960404:\n"
+                 "BL      sub_FF9612FC\n"
+                 "B       loc_FF960470\n"
+ "loc_FF96040C:\n"
+                 "BL      sub_FF962644\n"
+                 "B       loc_FF960470\n"
+ "loc_FF960414:\n"
+                 "BL      sub_FF962988\n"
+                 "B       loc_FF960470\n"
+ "loc_FF96041C:\n"
+                 "BL      sub_FF962A0C\n"
+                 "B       loc_FF960470\n"
+ "loc_FF960424:\n"
+                 "BL      sub_FF962AFC\n"
+                 "B       loc_FF960470\n"
+ "loc_FF96042C:\n"
+                 "MOV     R0, #0\n"
+                 "BL      sub_FF962BC4\n"
+                 "B       loc_FF960470\n"
+ "loc_FF960438:\n"
+                 "BL      sub_FF962D30\n"
+                 "B       loc_FF960470\n"
+ "loc_FF960440:\n"
+                 "BL      sub_FF962DC4\n"
+                 "B       loc_FF960470\n"
+ "loc_FF960448:\n"
+                 "BL      sub_FF962E80\n"
+                 "B       loc_FF960470\n"
+ "loc_FF960450:\n"
+                 "BL      sub_FF962F6C\n"
+                 "B       loc_FF960470\n"
+ "loc_FF960458:\n"
+                 "BL      sub_FF962FC0\n"
+                 "B       loc_FF960470\n"
+ "loc_FF960460:\n"
+                 "MOV     R1, #0x36C\n"
+                 "LDR     R0, =0xFF95FC2C\n"
+                 "ADD     R1, R1, #1\n"
+                 "BL      sub_FF813B80\n"
+ "loc_FF960470:\n"
+                 "LDR     R2, [SP]\n"
+ "loc_FF960474:\n"
+                 "LDR     R3, =0x6F344\n"
+                 "LDR     R1, [R2,#4]\n"
+                 "LDR     R0, [R3]\n"
+                 "BL      sub_FF81FD68\n"
+                 "LDR     R0, [SP]\n"
+                 "BL      sub_FF95FCA8\n"
+ "loc_FF96048C:\n"
+                 "LDR     R3, =0x6F348\n"
+                 "MOV     R1, R4\n"
+                 "LDR     R0, [R3]\n"
+                 "MOV     R2, #0\n"
+                 "BL      sub_FF820480\n"
+                 "TST     R0, #1\n"
+                 "BEQ     loc_FF960324\n"
+                 "MOV     R1, #0x2A4\n"
+                 "LDR     R0, =0xFF95FC2C\n"
+                 "ADD     R1, R1, #3\n"
+                 "BL      sub_FF813B80\n"
+                 "BL      sub_FF8219DC\n"
+                 "ADD     SP, SP, #4\n"
+                 "LDMFD   SP!, {R4,PC}\n"
+ );
+}
+
+
+
+
+
Index: /trunk/platform/ixus65_sd630/sub/100a/stubs_entry.S
===================================================================
--- /trunk/platform/ixus65_sd630/sub/100a/stubs_entry.S	(revision 511)
+++ /trunk/platform/ixus65_sd630/sub/100a/stubs_entry.S	(revision 511)
@@ -0,0 +1,173 @@
+// !!! THIS FILE IS GENERATED. DO NOT EDIT. !!!
+#include "stubs_asm.h"
+
+NSTUB(AllocateMemory, 0xff811ac4)
+NSTUB(AllocateUncacheableMemory, 0xff814cb0)
+NSTUB(Close, 0xff87056c)
+NSTUB(CreatePhysicalVram, 0xff935f78)
+NSTUB(CreateTask, 0xff82161c)
+NSTUB(CreateTaskStrict, 0xff8226bc)
+NSTUB(DisableDispatch, 0xff821440)
+// Best match: 96%
+NSTUB(DisplayImagePhysicalScreen, 0xff9352ac)
+NSTUB(EnableDispatch, 0xff8214cc)
+NSTUB(ExecuteEventProcedure, 0xff816bc8)
+NSTUB(ExitTask, 0xff8219dc)
+NSTUB(Fclose_Fut, 0xff86984c)
+NSTUB(Fopen_Fut, 0xff869810)
+NSTUB(Fread_Fut, 0xff869930)
+NSTUB(FreeMemory, 0xff811ad0)
+NSTUB(FreeUncacheableMemory, 0xff814ce4)
+NSTUB(Fseek_Fut, 0xff869a18)
+NSTUB(Fwrite_Fut, 0xff869980)
+NSTUB(GetCurrentAvValue, 0xffaccaa8)
+NSTUB(GetCurrentTargetDistance, 0xffacca50)
+// Best match: 96%
+NSTUB(GetFocusLensSubjectDistance, 0xffabed90)
+// Best match: 92%
+NSTUB(GetFocusLensSubjectDistanceFromLens, 0xffabf330)
+// Best match: 86%
+NSTUB(GetParameterData, 0xff9786ac)
+NSTUB(GetPropertyCase, 0xff8248e0)
+// Best match: 96%
+NSTUB(GetSystemTime, 0xff814ee8)
+// ALT: NSTUB(GetSystemTime, 0xff814ee8) // 26/1
+// Best match: 93%
+NSTUB(GetZoomLensCurrentPoint, 0xffaafa08)
+// ALT: NSTUB(GetZoomLensCurrentPoint, 0xffaafa08) // 27/2
+// Best match: 93%
+NSTUB(GetZoomLensCurrentPosition, 0xffaafa1c)
+// ALT: NSTUB(GetZoomLensCurrentPosition, 0xffaafa1c) // 27/2
+NSTUB(IsStrobeChargeCompleted, 0xff9112ec)
+NSTUB(LockMainPower, 0xff973874)
+NSTUB(MakeDirectory, 0xff870810)
+// Best match: 90%
+NSTUB(Mount_FileSystem, 0xff86f89c)
+// ALT: NSTUB(Mount_FileSystem, 0xff86f89c) // 27/3
+// Best match: 96%
+NSTUB(MoveFocusLensToDistance, 0xffacccf0)
+NSTUB(MoveZoomLensWithPoint, 0xffaaf8e8)
+// ALT: NSTUB(MoveZoomLensWithPoint, 0xffaaf8e8) // 25/0
+NSTUB(Open, 0xff870544)
+// Best match: 89%
+NSTUB(PhySw_testgpio, 0xff828020)
+NSTUB(ProtectFile, 0xff868e78)
+// Best match: 92%
+NSTUB(PutInNdFilter, 0xffacaac4)
+// ALT: NSTUB(PutInNdFilter, 0xffacaac4) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffacc654) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffacc654) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffacc69c) // 25/2
+// ALT: NSTUB(PutInNdFilter, 0xffacc69c) // 25/2
+// Best match: 94%
+NSTUB(PutOutNdFilter, 0xffacab0c)
+// ALT: NSTUB(PutOutNdFilter, 0xffacab0c) // 16/1
+NSTUB(Read, 0xff870600)
+NSTUB(RefreshPhysicalScreen, 0xff98a644)
+NSTUB(Remove, 0xff87058c)
+NSTUB(SetAutoShutdownTime, 0xff973778)
+// Best match: 86%
+NSTUB(SetParameterData, 0xff9785cc)
+NSTUB(SetPropertyCase, 0xff8247c4)
+NSTUB(SleepTask, 0xff821530)
+NSTUB(TakeSemaphore, 0xff82102c)
+NSTUB(UnlockMainPower, 0xff97390c)
+NSTUB(Unmount_FileSystem, 0xff86f940)
+// Best match: 89%
+NSTUB(UnsetZoomForMovie, 0xff9b1680)
+NSTUB(UpdateMBROnFlash, 0xff86fa90)
+// ERROR: VbattGet is not found!
+NSTUB(Write, 0xff87060c)
+NSTUB(_log, 0xffb079f8)
+// ALT: NSTUB(_log, 0xffb079f8) // 27/0
+NSTUB(_log10, 0xffb03d98)
+// ALT: NSTUB(_log10, 0xffb03d98) // 27/0
+NSTUB(_pow, 0xffb03f20)
+// ALT: NSTUB(_pow, 0xffb03f20) // 25/0
+NSTUB(_sqrt, 0xffb05df4)
+// ALT: NSTUB(_sqrt, 0xffb05df4) // 24/0
+NSTUB(chdir, 0xffb12b90)
+// ALT: NSTUB(chdir, 0xffb12b90) // 27/0
+NSTUB(close, 0xffb124d0)
+NSTUB(closedir, 0xffb0f958)
+// ERROR: free is not found!
+NSTUB(ints_disable, 0xff81da9c)
+NSTUB(ints_enable, 0xff81daa8)
+NSTUB(ioctl, 0xffb12610)
+NSTUB(iosDevAdd, 0xffb136f0)
+NSTUB(iosDrvInstall, 0xffb139b4)
+NSTUB(iosDevFind, 0xffb1367c)
+NSTUB(isalpha, 0xffb099fc)
+// ALT: NSTUB(isalpha, 0xffb099fc) // 4/0
+NSTUB(isdigit, 0xffb09a2c)
+// ALT: NSTUB(isdigit, 0xffb09a2c) // 4/0
+NSTUB(islower, 0xffb09a5c)
+// ALT: NSTUB(islower, 0xffb09a5c) // 4/0
+NSTUB(isspace, 0xffb09aa4)
+// ALT: NSTUB(isspace, 0xffb09aa4) // 4/0
+NSTUB(isupper, 0xffb09abc)
+// ALT: NSTUB(isupper, 0xffb09abc) // 4/0
+NSTUB(kbd_p1_f, 0xff826cec)
+NSTUB(kbd_p1_f_cont, 0xff826cf8)
+NSTUB(kbd_p2_f, 0xff8270d0)
+// Best match: 83%
+NSTUB(kbd_pwr_off, 0xff827fdc)
+// ALT: NSTUB(kbd_pwr_off, 0xff827ff8) // 5/1
+// ALT: NSTUB(kbd_pwr_off, 0xff82a1a4) // 5/1
+// ALT: NSTUB(kbd_pwr_off, 0xff82a1c0) // 5/1
+// ERROR: kbd_pwr_on is not found!
+NSTUB(kbd_read_keys_r2, 0xff827aac)
+// Best match: 93%
+NSTUB(localtime, 0xffb0e14c)
+NSTUB(lseek, 0xffb12614)
+// Best match: 53%
+NSTUB(malloc, 0xffb15510)
+// ALT: NSTUB(malloc, 0xffb15510) // 15/13
+NSTUB(memcmp, 0xffb0d52c)
+// ALT: NSTUB(memcmp, 0xffb1a0f0) // 9/0
+NSTUB(memcpy, 0xffb0d568)
+NSTUB(memset, 0xffb0d5e0)
+NSTUB(mkdir, 0xff870754)
+NSTUB(open, 0xffb12b14)
+NSTUB(opendir, 0xffb0f98c)
+NSTUB(qsort, 0xffb0cd8c)
+NSTUB(rand, 0xffb0cdb0)
+// ALT: NSTUB(rand, 0xffb0cdb0) // 8/0
+NSTUB(read, 0xffb12530)
+NSTUB(readdir, 0xffb0f924)
+NSTUB(rename, 0xffb12b1c)
+// ALT: NSTUB(rename, 0xffb12b1c) // 26/0
+NSTUB(rewinddir, 0xffb0f94c)
+NSTUB(srand, 0xffb0cdd4)
+// ALT: NSTUB(srand, 0xffb0cdd4) // 4/0
+NSTUB(stat, 0xffb0fa20)
+NSTUB(strcat, 0xffb0d600)
+NSTUB(strchr, 0xffb0d62c)
+NSTUB(strcmp, 0xffb0d650)
+NSTUB(strcpy, 0xffb0d7e4)
+NSTUB(strlen, 0xffb0d948)
+NSTUB(strncmp, 0xffb0d9ac)
+NSTUB(strncpy, 0xffb0d9f0)
+// ALT: NSTUB(strncpy, 0xffb0d9f0) // 24/0
+NSTUB(strpbrk, 0xffb0da38)
+NSTUB(strrchr, 0xffb0da74)
+// ALT: NSTUB(strrchr, 0xffb0da74) // 8/0
+NSTUB(strtol, 0xffb0d1c8)
+NSTUB(taskCreateHookAdd, 0xffb18b90)
+NSTUB(taskDeleteHookAdd, 0xffb18acc)
+// Best match: 82%
+NSTUB(taskIdListGet, 0xffb22b58)
+NSTUB(taskLock, 0xffb23214)
+NSTUB(taskName, 0xffb22a50)
+NSTUB(taskResume, 0xffb22e34)
+NSTUB(taskSuspend, 0xffb22c60)
+NSTUB(taskUnlock, 0xffb232bc)
+NSTUB(time, 0xffb0ee98)
+// ALT: NSTUB(time, 0xffb0ee98) // 25/0
+NSTUB(utime, 0xffb0fab4)
+// ALT: NSTUB(utime, 0xffb0fab4) // 26/0
+NSTUB(vsprintf, 0xffb11278)
+NSTUB(write, 0xffb125a0)
+NSTUB(fprintf, 0xffb0a35c)
+NSTUB(fputs, 0xffb0a47c)
+NSTUB(puts, 0xffb11634)
Index: /trunk/platform/ixus65_sd630/sub/100a/stubs_entry_2.S
===================================================================
--- /trunk/platform/ixus65_sd630/sub/100a/stubs_entry_2.S	(revision 511)
+++ /trunk/platform/ixus65_sd630/sub/100a/stubs_entry_2.S	(revision 511)
@@ -0,0 +1,52 @@
+#include "stubs_asm.h"
+
+NHSTUB(free, 0xFFB1551C)
+
+NSTUB(realloc, 0xFFB1475C)
+NSTUB(memmove, 0xFFB0D584)
+NSTUB(calloc,  0xFFB1472C)
+NSTUB(printf,  0xFFB11634)
+
+
+NHSTUB(kbd_pwr_off, 0xFF827FF8)
+NHSTUB(kbd_pwr_on, 0xFF827FDC)
+
+
+// Function reads Gpio Status into physw_status variable
+// call located at start of the 'kbd_p1_f' => 'PhySWTask'
+NHSTUB(kbd_read_keys, 0xFF826DB8)
+
+
+NHSTUB(VbattGet, 0xFF82D154)
+NHSTUB(SetZoomActuatorSpeedPercent, 0xFF8117EC)
+
+NHSTUB(ZZZ, 0x0)
+
+
+NSTUB(taskName, 0xFFB22A50)
+NSTUB(taskIdListGet, 0xFFB22B58)
+NSTUB(taskResume, 0xFFB22E34)
+NSTUB(taskSuspend, 0xFFB22C60)
+NSTUB(taskNameToId, 0xFFB22A74)
+
+// These two are indistinguishable!!!!
+// ????
+NSTUB(feof, 0xffb09d18)
+NSTUB(ferror, 0xffb09d84)
+
+
+STUB_DIR(vsprintf,0xFFB11278)
+
+NHSTUB(UnsetZoomForMovie ,0xFF9B1680)
+
+NHSTUB(GetDrive_ClusterSize, 0xFF86FD58)
+NHSTUB(GetDrive_TotalClusters, 0xFF86FD94)
+NHSTUB(GetDrive_FreeClusters, 0xFF868AD4)
+NHSTUB(GetBatteryTemperature, 0xFF82E220)
+NHSTUB(GetCCDTemperature, 0xFF82E20C)
+NHSTUB(GetOpticalTemperature, 0xFF82E1F8)
+NHSTUB(PT_PlaySound, 0xFF96AA98)
+
+
+//NHSTUB(EnterToCompensationEVF, 0xFFFFFFFF) // Stub not found. When found, remove dummy function from lib.c.
+//NHSTUB(ExitFromCompensationEVF, 0xFFFFFFFF) // Stub not found. When found, remove dummy function from lib.c.
Index: /trunk/platform/ixus65_sd630/sub/100a/boot.c
===================================================================
--- /trunk/platform/ixus65_sd630/sub/100a/boot.c	(revision 511)
+++ /trunk/platform/ixus65_sd630/sub/100a/boot.c	(revision 511)
@@ -0,0 +1,185 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+//#include "stdlib.h"
+
+const long new_sa = MEMISOSTART + MEMISOSIZE;
+
+/* Ours stuff */
+extern long wrs_kernel_bss_start;
+extern long wrs_kernel_bss_end;
+extern void createHook (void *pNewTcb);
+extern void deleteHook (void *pTcb);
+
+
+void boot();
+
+/* "relocated" functions */
+void __attribute__((naked,noinline)) h_usrInit();
+void __attribute__((naked,noinline)) h_usrKernelInit();
+void __attribute__((naked,noinline)) h_usrRoot();
+
+
+
+void boot()
+{
+    // offset of "start of data" string in primary.bin - 4
+    // All the asm code below is from: 0xFF8100F8
+
+    long *canon_data_src = (void*)0xFFB29580;
+    long *canon_data_dst = (void*)0x1900;
+    // up to the end of flash
+    long canon_data_len = 0xBDE0;
+    // just after ROM data
+    long *canon_bss_start = (void*)(0x1900+0xBDE0);
+    // BSS end offset (from FF810134 disasm) minus BSS start
+    long canon_bss_len = 0x9C6B0 - (long)canon_bss_start;
+    long i;
+
+    asm volatile (
+	"MRC     p15, 0, R0,c1,c0\n"
+	"ORR     R0, R0, #0x1000\n"
+	"ORR     R0, R0, #4\n"
+	"ORR     R0, R0, #1\n"
+	"MCR     p15, 0, R0,c1,c0\n"
+    :::"r0");
+/*
+	int * data = (int*)0x170000;
+	for (i = 0; i < 30*1024*1024/4; i++) {
+	  data[i] = 0xCAFEDEAD;
+	}
+*/
+
+    for(i=0;i<canon_data_len/4;i++)
+	canon_data_dst[i]=canon_data_src[i];
+
+    for(i=0;i<canon_bss_len/4;i++)
+	canon_bss_start[i]=0;
+
+
+    asm volatile (
+	"MRC     p15, 0, R0,c1,c0\n"
+	"ORR     R0, R0, #0x1000\n"
+	"BIC     R0, R0, #4\n"
+	"ORR     R0, R0, #1\n"
+	"MCR     p15, 0, R0,c1,c0\n"
+    :::"r0");
+    h_usrInit();
+}
+
+
+void h_usrInit()
+{
+    asm volatile (
+	"STR     LR, [SP,#-4]!\n"
+	"BL      sub_FF81196C\n"
+	"MOV     R0, #2\n"
+	"MOV     R1, R0\n"
+	"BL      sub_FFB0EED8\n"
+	"BL      sub_FFB01B4C\n"
+	"BL      sub_FF8111C4\n"
+	"BL      sub_FF81172C\n"
+	"LDR     LR, [SP],#4\n"
+	"B       h_usrKernelInit\n"
+    );
+}
+
+void  h_usrKernelInit()
+{
+    asm volatile (
+	"STMFD   SP!, {R4,LR}\n"
+	"SUB     SP, SP, #8\n"
+	"BL      sub_FFB0F3D8\n"
+	"BL      sub_FFB22BE0\n"
+	"LDR     R3, =0xC6F0\n"
+	"LDR     R2, =0x99340\n"
+	"LDR     R1, [R3]\n"
+	"LDR     R0, =0x9C070\n"
+	"MOV     R3, #0x100\n"
+	"BL      sub_FFB1BCF0\n"
+	"LDR     R3, =0xC6B0\n"
+	"LDR     R0, =0xCEF8\n"
+	"LDR     R1, [R3]\n"
+	"BL      sub_FFB1BCF0\n"
+	"LDR     R3, =0xC76C\n"
+	"LDR     R0, =0x9C044\n"
+	"LDR     R1, [R3]\n"
+	"BL      sub_FFB1BCF0\n"
+	"BL      sub_FFB27760\n"
+	"BL      sub_FF8112B0\n"
+	"MOV     R4, #0\n"
+	"MOV     R3, R0\n"
+	"MOV     R12, #0x800\n"
+	"LDR     R0, =h_usrRoot\n"  // !!!
+	"MOV     R1, #0x4000\n"
+    );    
+//	"LDR     R2, =0xCC6B0\n"	// !!! 0x9C6B0 + 0x30000    MEMISOSIZE!!!
+//	"LDR     R2, =0x18A6B0\n"   // !!! Increased size !!! 0x9C6B0+0x1ae000= 0x24A6B0-0x18A6B0=786432
+    asm volatile (
+        "LDR     R2, =new_sa\n"
+        "LDR     R2, [R2]\n"
+    );
+    asm volatile (
+	"STR     R12, [SP]\n"                    
+	"STR     R4, [SP,#4]\n"
+	"BL      sub_FFB1FE20\n"
+	"ADD     SP, SP, #8\n"
+	"LDMFD   SP!, {R4,PC}\n"
+    );
+}
+
+static long drv_struct[16];
+ 
+static long dh_err()
+{
+    return -1;
+}
+
+static void drv_self_hide()
+{
+    long drvnum;
+    
+    drvnum = _iosDrvInstall(dh_err,dh_err,dh_err,dh_err,dh_err,dh_err,dh_err);
+    if (drvnum >= 0)
+	_iosDevAdd(drv_struct, "A/DISKBOOT.BIN", drvnum);
+}
+
+void  h_usrRoot()
+{
+    asm volatile
+    (
+	"STMFD   SP!, {R4,R5,LR}\n"
+	"MOV     R5, R0\n"
+	"MOV     R4, R1\n"
+	"BL      sub_FF8119D4\n"
+	"MOV     R1, R4\n"
+	"MOV     R0, R5\n"
+	"BL      sub_FFB1406C\n"
+	"MOV     R1, R4\n"
+	"MOV     R0, R5\n"
+	"BL      sub_FFB14AE4\n"
+	"BL      sub_FF811708\n"
+	"MOV     R0, #0x32\n"
+	"BL      sub_FFB16A88\n"  // selectInit
+    );
+
+    asm volatile
+    (	
+	"BL      sub_FF811A14\n" //ios_tty_Init
+	"BL      sub_FF8119F8\n"
+	"BL      sub_FF811A40\n"
+	"BL      sub_FFB16348\n"
+	"BL      sub_FF8119C8\n"
+    );
+
+    _taskCreateHookAdd(createHook);
+    _taskDeleteHookAdd(deleteHook);
+
+    drv_self_hide();
+
+    asm volatile (
+	"LDMFD   SP!, {R4,R5,LR}\n"
+	"B       sub_FF811370\n"
+    );
+}
+
Index: /trunk/platform/ixus65_sd630/sub/100a/stubs_min.S
===================================================================
--- /trunk/platform/ixus65_sd630/sub/100a/stubs_min.S	(revision 511)
+++ /trunk/platform/ixus65_sd630/sub/100a/stubs_min.S	(revision 511)
@@ -0,0 +1,44 @@
+#include "stubs_asm.h"
+
+#include "stubs_entry_ida.S"
+
+DEF(physw_run, 0x1FAC)
+DEF(physw_status, 0xE758)
+
+// The names below could be found automanically
+// by looking up the strings with the same names as these variables
+// and function 'ShowPhySwStatus' which is also symbolic
+DEF(NotifyMask, 0x0000E728)
+DEF(SwitchMask, 0x0000E738)
+DEF(InvertData, 0x0000E748)
+// This is the real name for 'physw_status'
+DEF(GpioStatus, 0x0000E758)
+DEF(SwitchStatus, 0x0000E768)
+
+
+// Key values for 'Feather' on joystic
+// Could be retrieved from 'PhySW' Task function
+DEF(touch_keys_angle, 0x0000E8C8)
+
+DEF(zoom_busy, 0x79E20)
+DEF(focus_busy, 0x7A13C)
+DEF(movie_compression, 0x617C)
+
+
+// TODO: !!!!!!!!!!!!! THESE ARE INVALID !!!!!!!!
+DEF(FlashParamsTable,0xFFD4B62C)
+//DEF(canon_menu_active, 0x6CBC)
+//DEF(canon_shoot_menu_active, 0x6CBC)
+//DEF(recreview_hold, 0x6CBC)
+
+//DEF(canon_menu_active, 0x6CBC)
+//DEF(canon_shoot_menu_active, 0x6CBC)
+
+
+canon_menu_active_prev:
+	.word 0x10
+
+.globl canon_menu_active
+canon_menu_active:
+	.word canon_menu_active_prev
+
Index: /trunk/platform/ixus65_sd630/sub/100a/makefile.inc
===================================================================
--- /trunk/platform/ixus65_sd630/sub/100a/makefile.inc	(revision 511)
+++ /trunk/platform/ixus65_sd630/sub/100a/makefile.inc	(revision 511)
@@ -0,0 +1,17 @@
+#0x30FE=
+PLATFORMID=12542
+
+PLATFORMOS=vxworks
+
+MEMBASEADDR=0x1900
+RESTARTSTART=0x50000
+MEMISOSTART=0x9C6B0
+#MEMISOSIZE=0x1ae000
+MEMISOSIZE=0x55000
+#0x30000
+ROMBASEADDR=0xff800000
+
+TARGET_PRIMARY=$(topdir)platform/$(PLATFORM)/sub/$(PLATFORMSUB)/PRIMARY.BIN
+
+PLFLAGS=-DMEMBASEADDR=$(MEMBASEADDR) -DMEMISOSTART=$(MEMISOSTART) -DMEMISOSIZE=$(MEMISOSIZE)
+PLFLAGS+=-DRESTARTSTART=$(RESTARTSTART)
Index: /trunk/platform/ixus65_sd630/sub/100a/stubs_asm.h
===================================================================
--- /trunk/platform/ixus65_sd630/sub/100a/stubs_asm.h	(revision 511)
+++ /trunk/platform/ixus65_sd630/sub/100a/stubs_asm.h	(revision 511)
@@ -0,0 +1,28 @@
+    .text
+
+#define DEF(n,a) \
+    .globl n; n = a
+
+#define NSTUB(name, addr)\
+    .globl _##name ;\
+    .globl name ;\
+    .weak _##name ;\
+    .weak name ;\
+    _##name: ;\
+    name: ;\
+	ldr  pc, = ## addr
+
+#define NHSTUB(name, addr)\
+    .globl _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define STUB(addr)\
+    .globl sub_ ## addr ;\
+    sub_ ## addr: ;\
+	ldr  pc, =0x ## addr
+
+#define STUB_DIR(name, addr)\
+    .globl name ;\
+    name: ;\
+	ldr  pc, = addr
Index: /trunk/platform/ixus65_sd630/sub/100a/lib.c
===================================================================
--- /trunk/platform/ixus65_sd630/sub/100a/lib.c	(revision 511)
+++ /trunk/platform/ixus65_sd630/sub/100a/lib.c	(revision 511)
@@ -0,0 +1,86 @@
+#include "platform.h"
+
+int recreview_hold = 0;
+char canon_shoot_menu_active = 0;
+
+void *hook_raw_fptr()
+{
+    return (void*)0x36A90;
+}
+
+void *hook_raw_ret_addr()
+{
+    return (void*)0xFFCB4C5C;
+}
+
+char *hook_raw_image_addr()
+{
+    return (char*)0x105B8AC0;
+}
+
+long hook_raw_size()
+{
+    return 0x75A8F0;
+}
+
+/**
+ * OSD screen
+ */
+void *vid_get_bitmap_fb()
+{
+    return (void*)0x103C79A0;
+}
+
+/**
+ * TODO: ??????
+ */
+void *vid_get_viewport_live_fb()
+{
+    return (void*)0;
+}
+
+/**
+ * IMG viewport in 'rec' mode
+ */
+void *vid_get_viewport_fb()
+{
+    return (void*)0x10559570;
+}
+
+/**
+ * IMG viewport in 'play' mode
+ */
+void *vid_get_viewport_fb_d()
+{
+    return 0x104AFCA0;
+    //return (void*)(*(int*));
+}
+
+long vid_get_bitmap_screen_width()
+{
+    return 360;
+}
+
+long vid_get_bitmap_screen_height()
+{
+    return 240;
+}
+
+long vid_get_viewport_height()
+{
+    return 240;
+}
+
+char *camera_jpeg_count_str()
+{
+    //TODO: fix this!!
+    return (char*)0x10B80;
+}
+int movie_status = 0;
+
+long vid_get_bitmap_buffer_width() { return 360; }
+
+long vid_get_bitmap_buffer_height() { return 240; }
+
+void _EnterToCompensationEVF() {} // Dummy function. To be removed after stub is found. See stubs_entry_2.S.
+void _ExitFromCompensationEVF() {} // Dummy function. To be removed after stub is found. See stubs_entry_2.S.
Index: /trunk/platform/ixus65_sd630/sub/100a/primary.bin.txt
===================================================================
--- /trunk/platform/ixus65_sd630/sub/100a/primary.bin.txt	(revision 511)
+++ /trunk/platform/ixus65_sd630/sub/100a/primary.bin.txt	(revision 511)
@@ -0,0 +1,2 @@
+in:
+/branches/cail-abtrunk/platform/ixus65_sd630/sub/100a/PRIMARY.BIN
Index: /trunk/platform/ixus65_sd630/sub/100a/stubs_auto.S
===================================================================
--- /trunk/platform/ixus65_sd630/sub/100a/stubs_auto.S	(revision 511)
+++ /trunk/platform/ixus65_sd630/sub/100a/stubs_auto.S	(revision 511)
@@ -0,0 +1,70 @@
+/* THIS FILE IS GENERATED */
+/* DO NOT EDIT THIS FILE! */
+
+#include "stubs_asm.h"
+
+STUB(FF8111C4)
+STUB(FF8112B0)
+STUB(FF811370)
+STUB(FF811708)
+STUB(FF81172C)
+STUB(FF81196C)
+STUB(FF8119C8)
+STUB(FF8119D4)
+STUB(FF8119F8)
+STUB(FF811A14)
+STUB(FF811A40)
+STUB(FF813B80)
+STUB(FF81FD68)
+STUB(FF81FF04)
+STUB(FF820480)
+STUB(FF8219DC)
+STUB(FF824ADC)
+STUB(FF89EFF0)
+STUB(FF89F4B0)
+STUB(FF95E090)
+STUB(FF95E574)
+STUB(FF95FCA8)
+STUB(FF95FEA0)
+STUB(FF95FF70)
+STUB(FF960044)
+STUB(FF960F60)
+STUB(FF9612FC)
+STUB(FF96130C)
+STUB(FF961D60)
+STUB(FF961E44)
+STUB(FF961EAC)
+STUB(FF9620F0)
+STUB(FF962100)
+STUB(FF9625A0)
+STUB(FF962604)
+STUB(FF962644)
+STUB(FF962988)
+STUB(FF962A0C)
+STUB(FF962AFC)
+STUB(FF962BC4)
+STUB(FF962D30)
+STUB(FF962DC4)
+STUB(FF962E80)
+STUB(FF962F6C)
+STUB(FF962FC0)
+STUB(FF963298)
+STUB(FF963344)
+STUB(FF963380)
+STUB(FF96353C)
+STUB(FF963AB0)
+STUB(FF968658)
+STUB(FF968664)
+STUB(FF968678)
+STUB(FF9A15A8)
+STUB(FFB01B4C)
+STUB(FFB0EED8)
+STUB(FFB0F3D8)
+STUB(FFB1406C)
+STUB(FFB14AE4)
+STUB(FFB16348)
+STUB(FFB16A88)
+STUB(FFB1BCF0)
+STUB(FFB1FE20)
+STUB(FFB22BE0)
+STUB(FFB27760)
Index: /trunk/platform/ixus65_sd630/sub/100a/stubs_auto_gen.pl
===================================================================
--- /trunk/platform/ixus65_sd630/sub/100a/stubs_auto_gen.pl	(revision 511)
+++ /trunk/platform/ixus65_sd630/sub/100a/stubs_auto_gen.pl	(revision 511)
@@ -0,0 +1,13 @@
+
+
+while(<STDIN>) {
+
+  if ( / B(L?) \s+ SUB_([\da-fA-F]+) /ix ) {
+     
+     next if ( $H{$2} );
+     
+     $H{$2} = 1;
+     print "STUB($2)\n";
+  }
+
+}
Index: /trunk/platform/ixus65_sd630/sub/100a/Makefile
===================================================================
--- /trunk/platform/ixus65_sd630/sub/100a/Makefile	(revision 511)
+++ /trunk/platform/ixus65_sd630/sub/100a/Makefile	(revision 511)
@@ -0,0 +1,6 @@
+topdir=../../../../
+
+OBJS=boot.o stubs_min.o stubs_auto.o stubs_entry.o lib.o stubs_entry_2.o capt_seq.o
+STUBS_AUTO_DEPS=boot.c capt_seq.c
+
+include $(topdir)/platform/makefile_sub.inc
Index: /trunk/platform/ixus65_sd630/sub/Makefile
===================================================================
--- /trunk/platform/ixus65_sd630/sub/Makefile	(revision 511)
+++ /trunk/platform/ixus65_sd630/sub/Makefile	(revision 511)
@@ -0,0 +1,8 @@
+topdir=../../../
+include $(topdir)makefile.inc
+
+SUBDIRS=$(PLATFORMSUB)
+
+all: all-recursive
+
+clean: clean-recursive
Index: /trunk/platform/ixus65_sd630/shooting.c
===================================================================
--- /trunk/platform/ixus65_sd630/shooting.c	(revision 511)
+++ /trunk/platform/ixus65_sd630/shooting.c	(revision 511)
@@ -0,0 +1,135 @@
+#define PARAM_FILE_COUNTER      0x34
+
+#include "platform.h"
+
+const ApertureSize aperture_sizes_table[] = {
+    {  9, 290, "2.8" },
+    { 10, 313, "3.2" },
+    { 11, 337, "3.5" },
+    { 12, 391, "4.0" },
+    { 13, 420, "4.5" },
+    { 14, 448, "5.0" },
+    { 15, 480, "5.6" },
+    { 16, 512, "6.3" },
+    { 17, 544, "7.1" },
+    { 18, 576, "8.0" },
+    { 19, 999, "x.x" },
+};
+
+const ShutterSpeed shutter_speeds_table[] = {
+    { -12, -384, "15", 15000000 },
+    { -11, -352, "13", 13000000 },
+    { -10, -320, "10", 10000000 },
+    {  -9, -288, "8",   8000000 },
+    {  -8, -256, "6",   6000000 },
+    {  -7, -224, "5",   5000000 },
+    {  -6, -192, "4",   4000000 },
+    {  -5, -160, "3.2", 3200000 },
+    {  -4, -128, "2.5", 2500000 },
+    {  -3,  -96, "2",   2000000 },
+    {  -2,  -64, "1.6", 1600000 },
+    {  -1,  -32, "1.3", 1300000 },
+    {   0,    0, "1",   1000000 },
+    {   1,   32, "0.8",  800000 },
+    {   2,   64, "0.6",  600000 },
+    {   3,   96, "0.5",  500000 },
+    {   4,  128, "0.4",  400000 },
+    {   5,  160, "0.3",  300000 },
+    {   6,  192, "1/4",  250000 },
+    {   7,  224, "1/5",  200000 },
+    {   8,  256, "1/6",  166667 },
+    {   9,  288, "1/8",  125000 },
+    {  10,  320, "1/10", 100000 },
+    {  11,  352, "1/13",  76923 },
+    {  12,  384, "1/15",  66667 },
+    {  13,  416, "1/20",  50000 },
+    {  14,  448, "1/25",  40000 },
+    {  15,  480, "1/30",  33333 },
+    {  16,  512, "1/40",  25000 },
+    {  17,  544, "1/50",  20000 },
+    {  18,  576, "1/60",  16667 },
+    {  19,  608, "1/80",  12500 },
+    {  20,  640, "1/100", 10000 },
+    {  21,  672, "1/125",  8000 },
+    {  22,  704, "1/160",  6250 },
+    {  23,  736, "1/200",  5000 },
+    {  24,  768, "1/250",  4000 },
+    {  25,  800, "1/320",  3125 },
+    {  26,  832, "1/400",  2500 },
+    {  27,  864, "1/500",  2000 },
+    {  28,  896, "1/640",  1563 },
+    {  29,  928, "1/800",  1250 },
+    {  30,  960, "1/1000", 1000 },
+    {  31,  992, "1/1250",  800 },
+    {  32, 1021, "1/1600",  625 },
+    {  33, 1053, "1/2000",  500 },
+    {  34, 1084, "1/2500",  400 },
+};
+
+const ISOTable iso_table[] = {
+    {  0,    0, "Auto", -1},
+    {  1,   50,   "50", -1},
+    {  2,  100,  "100", -1},
+    {  3,  200,  "200", -1},
+    {  4,  400,  "400", -1},
+    {  5,  800,  "800", -1},
+};          
+
+#include "../generic/shooting.c"
+
+long get_file_next_counter() {
+    return ((get_file_counter()>>4)+1)<<4;
+}
+
+long get_target_file_num() {
+    long n;
+    
+    n = get_file_next_counter();
+    n = (n>>4)&0x3FFF;
+    return n;
+}
+
+long get_target_dir_num() {
+    long n;
+    
+    n = get_file_next_counter();
+    n = (n>>18)&0x3FF;
+    if (get_target_file_num()%100 == 1) ++n;
+    return n;
+}
+
+int circle_of_confusion = 6;
+
+void change_video_tables(int a, int b)
+{
+}
+
+char* shooting_get_tv_str()
+{
+    short int tvv;
+    long i;
+    
+    _GetPropertyCase(PROPCASE_TV, &tvv, sizeof(tvv));
+
+    for (i=0;i<SS_SIZE;i++)
+    {
+        if (shutter_speeds_table[i].prop_id >= tvv)
+          return (char*)shutter_speeds_table[i].name;
+    }
+    return (void*)"?";
+}
+
+char* shooting_get_av_str()
+{
+    short int avv;
+    long i;
+    
+    _GetPropertyCase(PROPCASE_AV, &avv, sizeof(avv));
+
+    for (i = 0; i < AS_SIZE-1; i++)
+    {
+        if (aperture_sizes_table[i].prop_id <= avv && aperture_sizes_table[i+1].prop_id > avv)
+          return (char*)aperture_sizes_table[i].name;
+    }
+    return (char*) "?";
+}
Index: /trunk/platform/ixus65_sd630/Makefile
===================================================================
--- /trunk/platform/ixus65_sd630/Makefile	(revision 511)
+++ /trunk/platform/ixus65_sd630/Makefile	(revision 511)
@@ -0,0 +1,26 @@
+curdir=./
+topdir=../../
+
+include $(topdir)makefile.inc
+
+CFLAGS+=-DLOW_LEVEL
+
+SUBDIRS=sub
+
+all: all-recursive libplatform.a
+
+OBJS=main.o lib.o wrappers.o kbd.o shooting.o
+# stubs_init.o
+
+kbd.o: kbd.c ../generic/kbd.c
+lib.o: lib.c ../generic/lib.c
+main.o: main.c ../generic/main.c
+shooting.o: shooting.c ../generic/shooting.c
+wrappers.o: wrappers.c ../generic/wrappers.c
+
+libplatform.a: $(OBJS)
+
+clean: clean-recursive
+	rm -f $(OBJS) libplatform.a
+
+include $(topdir)bottom.inc
Index: /trunk/platform/s5is/kbd.c
===================================================================
--- /trunk/platform/s5is/kbd.c	(revision 511)
+++ /trunk/platform/s5is/kbd.c	(revision 511)
@@ -0,0 +1,538 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+#include "conf.h"
+#include "keyboard.h"
+
+typedef struct {
+	short grp;
+	short hackkey;
+	long canonkey;
+} KeyMap;
+
+
+static long kbd_new_state[3];
+static long kbd_prev_state[3];
+static long kbd_mod_state[3];
+
+static long last_kbd_key = 0;
+static long alt_mode_key_mask = 0x00000040;
+static int alt_mode_led=0;
+static int usb_power=0;
+static int remote_key, remote_count;
+static int shoot_counter=0;
+#define DELAY_TIMEOUT 10000
+
+
+#define KEYS_MASK0 (0x00000003)
+#define KEYS_MASK1 (0x7F3F7860)
+#define KEYS_MASK2 (0x00000000)
+
+#define NEW_SS (0x2000)
+#define SD_READONLY_FLAG (0x20000)
+#define USB_MASK (0x200000)
+#define USB_REG 2
+
+
+#ifndef MALLOCD_STACK
+static char kbd_stack[NEW_SS];
+#endif
+
+
+static KeyMap keymap[] = {
+	/* tiny bug: key order matters. see kbd_get_pressed_key()
+	 * for example
+	 */
+// physw_status[1] total mask: 0x7F3F7860
+//	{ 1, ??           , 0x80000000 }, // Default 0, unused?
+	{ 1, KEY_MACRO    , 0x40000000 }, 
+	{ 1, KEY_MF       , 0x20000000 }, 
+	{ 1, KEY_ZOOM_IN  , 0x10000000 }, // Zoom_in_fast  = 0x08000000 | 0x10000000
+//	{ 1, KEY_ZOOMFIN  , 0x08000000 }, // Not defined in CHDK
+//	{ 1, KEY_ZOOMFOUT , 0x04000000 }, // Not defined in CHDK
+	{ 1, KEY_TIMER    , 0x02000000 }, 
+	{ 1, KEY_ZOOM_OUT , 0x01000000 }, // Zoom_out_fast = 0x04000000 | 0x01000000
+//	{ 1, ??           , 0x00800000 }, // Default 0, unused?
+//	{ 1, ??           , 0x00400000 }, // Default 1, unused?
+	{ 1, KEY_RIGHT    , 0x00200000 }, 
+	{ 1, KEY_UP       , 0x00100000 }, 
+	{ 1, KEY_DOWN     , 0x00080000 }, 
+	{ 1, KEY_MENU     , 0x00040000 }, 
+	{ 1, KEY_DISPLAY  , 0x00020000 }, 
+	{ 1, KEY_SET      , 0x00010000 }, 
+//	{ 1, ??           , 0x00008000 }, // Default 0, unused?
+	{ 1, KEY_ERASE    , 0x00004000 }, 
+	{ 1, KEY_VIDEO    , 0x00002000 }, 
+	{ 1, KEY_LEFT     , 0x00001000 }, 
+	{ 1, KEY_ISO      , 0x00000800 }, 
+//	{ 1, ??           , 0x00000400 }, // Default 1, unused?
+//	{ 1, KEY_DISP_ROTA, 0x00000200 }, // Indicates whether or not display is rotated, not defined, though used in CHDK
+//   { 1, KEY_DISP_OPEN, 0x00000100 }, // Indicates whether or not display is attached to body (i.e. not 'opened'), not defined, though used in CHDK
+//	{ 1, ??           , 0x00000080 }, // Default 0, unused?
+	{ 1, KEY_PRINT    , 0x00000040 }, 
+	{ 1, KEY_FLASH    , 0x00000020 }, 
+//	{ 1, KEY_FL_RAISED, 0x00000010 }, // Indicates whether or not the flash is raised, not defined in CHDK
+//	{ 1, KEY_MODE_DIAL, 0x0000000F }, // Listed for completeness of the keymap
+//   { 1, MODE_DIAL_P         , 0x00000007 },
+//   { 1, MODE_DIAL_TV        , 0x00000003 },
+//   { 1, MODE_DIAL_AV        , 0x00000002 },
+//   { 1, MODE_DIAL_M         , 0x00000006 },
+//   { 1, MODE_DIAL_C         , 0x00000004 },
+//   { 1, MODE_DIAL_AUTO      , 0x0000000F },
+//   { 1, MODE_DIAL_PORTRAIT  , 0x0000000E },
+//   { 1, MODE_DIAL_LANDSCAPE , 0x0000000A },
+//   { 1, MODE_DIAL_NIGHT     , 0x0000000B },
+//   { 1, MODE_DIAL_SPORTS    , 0x00000009 },
+//   { 1, MODE_DIAL_SPECIAL   , 0x00000001 },
+//   { 1, MODE_DIAL_STITCH    , 0x00000005 },
+//   { 1, MODE_DIAL_MOVIE     , 0x0000000D },
+//   { 1, MODE_DIAL_EMPTY     , 0x0000000C },
+// 0 and 8 appear to be unused
+
+
+// physw_status[0] // 6 listed keys seem to fully cover [0], though some appear to use negative logic so can't be certain.
+//	{ 0, KEY_OFF       , 0x00020000 }, // Not defined in CHDK
+//	{ 0, KEY_OPEN_BATT , 0x00008000 }, // Indicates whether or not the battery compartment is about to be opened (slider is a button). Camera does not retract lens, though, shame. Not defined in CHDK
+//	{ 0, KEY_M_DISPLAY , 0x00000008 }, // Switch to display mode, not defined in CHDK (negative? Default 0, 1 when switching)
+//	{ 0, KEY_M_SHOOT   , 0x00000004 }, // Switch to shoot mode, not defined in CHDK (negative? Default 0, 1 when switching)
+//	{ 0, KEY_SHOOT_FULL, 0x00000002 }, // Listed for completeness, this is the 'single' key.
+	{ 0, KEY_SHOOT_FULL, 0x00000003 }, // This is SHOOT_FULL | SHOOT_HALF.
+	{ 0, KEY_SHOOT_HALF, 0x00000001 }, 
+
+
+// physw_status[2]
+//	{ 2, USB_ATTACH    , 0x00200000 }, // 0 = no USB, 1 = USB attached
+//	{ 2, FLASH_ATTACH  , 0x00080000 }, // 0 = no flash, 1 = Hotshoe external flash attached
+//   { 2, TVOUT_ATTACH  , 0x00040000 }, // 1 = no tvout, 0 = tvout attached
+//	{ 2, SD_LOCK       , 0x00020000 }, // 0 = unlocked, 1 = locked
+
+
+// I don't really remember whether or not this is correct, listed for completeness
+// Shoot mode   = (*((long *)0xC0220200) & 0xD) == 0xD
+// Display mode = (*((long *)0xC0220200) & 0xD) == 0x0
+
+	{ 0, 0 }
+};
+
+
+long __attribute__((naked)) wrap_kbd_p1_f() ;
+
+void wait_until_remote_button_is_released(void)
+{
+
+long x[3];
+int count1;
+int count2;
+int tick,tick2,tick3;
+int nSW;
+int prev_usb_power,cur_usb_power;
+ // ------ add by Masuji SUTO (start) --------------
+    static int nMode;
+ // ------ add by Masuji SUTO (end)   --------------
+
+asm volatile ("STMFD SP!, {R0-R11,LR}\n"); // store R0-R11 and LR in stack
+debug_led(1);
+tick = get_tick_count();
+tick2 = tick;
+static long usb_physw[3];
+if (conf.synch_enable && conf.ricoh_ca1_mode && conf.remote_enable && (!shooting_get_drive_mode()|| ((shooting_get_drive_mode()==2) && state_shooting_progress != SHOOTING_PROGRESS_PROCESSING)))  // synch mode enable so wait for USB to disconnect
+  {
+// ------ add by Masuji SUTO (start) --------------
+        nMode=0;
+        usb_physw[2] = 0;                                             // makes sure USB bit is cleared.
+        _kbd_read_keys_r2(usb_physw);
+        if((usb_physw[2] & USB_MASK)==USB_MASK) nMode=1;
+// ------ add by Masuji SUTO (end)   --------------
+     if(conf.ricoh_ca1_mode && conf.remote_enable)
+     {
+	if(shooting_get_drive_mode()==1 && state_shooting_progress == SHOOTING_PROGRESS_PROCESSING){			//continuous-shooting mode
+		if(conf.bracket_type>2){
+			if(shoot_counter<2) shutter_int=3;
+			shoot_counter--;
+			}
+		else{
+			prev_usb_power=0;
+			nSW = 0;
+			do
+				{     
+				usb_physw[2] = 0;                                             // makes sure USB bit is cleared.
+				_kbd_read_keys_r2(usb_physw);
+				cur_usb_power = (usb_physw[2] & USB_MASK)==USB_MASK;
+				if(cur_usb_power){
+					if(!prev_usb_power){
+						tick2 = get_tick_count();
+						prev_usb_power=cur_usb_power;
+						}
+					else{
+						if((int)get_tick_count()-tick2>1000) {debug_led(0);}
+						}
+					}
+				else{
+					if(prev_usb_power){
+						tick3 = (int)get_tick_count()-tick2;
+						if(nSW==10) {
+							if(tick3>50) shutter_int=1;
+							nSW=20;
+							}
+						if(nSW==0 && tick3>0) {
+							if(tick3<50) {
+							nSW=10;
+							}
+						else{
+							if(tick3>1000) shutter_int=1;
+								nSW=20;
+							}
+						}
+						prev_usb_power=cur_usb_power;
+						}
+					}
+				if((int)get_tick_count()-tick >= DELAY_TIMEOUT) {nSW=20;shutter_int=2;}
+				}
+			 while(nSW<20);
+			 }
+		} 		//continuous-shooting mode 
+		else{		//nomal mode 
+			shoot_counter=0;
+			if(conf.bracket_type>2){
+				shoot_counter=(conf.bracket_type-2)*2;
+				}
+        do
+           {
+         //  _platformsub_kbd_fetch_data(x);
+           usb_physw[2] = 0;
+          _kbd_read_keys_r2(usb_physw);            
+           }
+
+// ------ modif by Masuji SUTO (start) --------------
+    while(((((usb_physw[2] & USB_MASK)!=USB_MASK) && (nMode==0)) || (((usb_physw[2] & USB_MASK)==USB_MASK) && (nMode==1))) && ((int)get_tick_count()-tick < DELAY_TIMEOUT));
+// ------ modif by Masuji SUTO (end)   --------------
+	}
+       } // ricoh ca-1 mode
+
+else
+
+       {
+         do
+          {
+         //  _platformsub_kbd_fetch_data(x);
+           usb_physw[2] = 0;
+          _kbd_read_keys_r2(usb_physw);           
+           }
+        while((usb_physw[2]&USB_MASK) &&  ((int)get_tick_count()-tick < DELAY_TIMEOUT));
+
+        }
+
+  } // synch enable
+
+
+if (conf.synch_delay_enable && conf.synch_delay_value>0)       // if delay is switched on and greater than 0
+  {
+    for (count1=0;count1<conf.synch_delay_value+(conf.synch_delay_coarse_value*1000);count1++) // wait delay_value * 0.1ms
+    {
+      for (count2=0;count2<1400;count2++)            // delay approx. 0.1ms
+        {
+        }
+     }
+  }
+
+debug_led(0);
+
+asm volatile ("LDMFD SP!, {R0-R11,LR}\n"); // restore R0-R11 and LR from stack
+}
+
+static void __attribute__((noinline)) mykbd_task_proceed()
+{
+	while (physw_run){
+		_SleepTask(10);
+		
+		if (wrap_kbd_p1_f() == 1){ // autorepeat ?
+			_kbd_p2_f();
+		}
+	}
+}
+
+void __attribute__((naked,noinline)) mykbd_task()
+{
+    /* WARNING
+     * Stack pointer manipulation performed here!
+     * This means (but not limited to):
+     *	function arguments destroyed;
+     *	function CAN NOT return properly;
+     *	MUST NOT call or use stack variables before stack
+     *	is setup properly;
+     *
+     */
+
+	register int i;
+	register long *newstack;
+
+#ifndef MALLOCD_STACK
+	newstack = (void*)kbd_stack;
+#else
+	newstack = malloc(NEW_SS);
+#endif
+
+	for (i=0;i<NEW_SS/4;i++)
+		newstack[i]=0xdededede;
+
+	asm volatile (
+		"MOV	SP, %0"
+		:: "r"(((char*)newstack)+NEW_SS)
+		: "memory"
+	);
+
+	mykbd_task_proceed();
+
+	/* function can be modified to restore SP here...
+	 */
+
+	_ExitTask();
+}
+
+
+long __attribute__((naked,noinline)) wrap_kbd_p1_f()
+{
+
+	asm volatile(
+		"STMFD   SP!, {R1-R5,LR}\n"
+		"MOV     R4, #0\n"
+		"BL      _kbd_read_keys\n"
+		"BL      my_kbd_read_keys\n"
+		"B       _kbd_p1_f_cont\n"
+	);
+	return 0; // shut up the compiler
+}
+
+
+void my_kbd_read_keys()
+{
+	kbd_prev_state[0] = kbd_new_state[0];
+	kbd_prev_state[1] = kbd_new_state[1];
+	kbd_prev_state[2] = kbd_new_state[2];
+	
+	// The following three lines replace the call to kbd_fetch_data
+	kbd_new_state[0] = physw_status[0];
+	kbd_new_state[1] = physw_status[1];
+	kbd_new_state[2] = physw_status[2];
+	
+	
+	if (kbd_process() == 0){
+		// leave it alone...
+		// keyboard state is already good so nothing needs to happen
+		
+		// But do override the alt mode key
+		physw_status[1] |= alt_mode_key_mask;
+	} else {
+		// override keys
+		physw_status[0] = (kbd_new_state[0] | KEYS_MASK0) & (~KEYS_MASK0 | kbd_mod_state[0]); // Only overrides shoot-button... off, batt and modeswitch are still enabled.
+		physw_status[1] = (kbd_new_state[1] | KEYS_MASK1) & (~KEYS_MASK1 | kbd_mod_state[1]); // Overrides everything except mode-dial (0xF)
+		physw_status[2] = (kbd_new_state[2] | KEYS_MASK2) & (~KEYS_MASK2 | kbd_mod_state[2]); // Currently overrides nothing
+	}
+	
+	remote_key = (physw_status[2] & USB_MASK)==USB_MASK;
+		if (remote_key) 
+			remote_count += 1;
+		else if (remote_count) {
+			usb_power = remote_count;
+			remote_count = 0;
+		}
+	if (conf.remote_enable) {
+		physw_status[2] = physw_status[2] & ~(SD_READONLY_FLAG | USB_MASK);
+		// As much as I'd like to immediately shoot, this trigger is intended for use in scripts, so don't shoot here.
+		//if(remote_key) physw_status[0] &= ~(0x3); // Shoot!
+	} else {
+		physw_status[2] = physw_status[2] & ~SD_READONLY_FLAG;
+	}
+
+}
+
+
+
+/****************/
+
+void kbd_set_alt_mode_key_mask(long key)
+{
+	int i;
+	for (i=0; keymap[i].hackkey; ++i) {
+		if (keymap[i].hackkey == key) {
+			alt_mode_key_mask = keymap[i].canonkey;
+			return;
+		}
+	}
+}
+
+
+void kbd_key_press(long key)
+{
+	int i;
+	for (i=0;keymap[i].hackkey;i++){
+		if (keymap[i].hackkey == key){
+			kbd_mod_state[keymap[i].grp] &= ~keymap[i].canonkey;
+			return;
+		}
+	}
+}
+
+void kbd_key_release(long key)
+{
+	int i;
+	for (i=0;keymap[i].hackkey;i++){
+		if (keymap[i].hackkey == key){
+			kbd_mod_state[keymap[i].grp] |= keymap[i].canonkey;
+			return;
+		}
+	}
+}
+
+void kbd_key_release_all()
+{
+	kbd_mod_state[0] |= 0xFFFFFFFF;
+	kbd_mod_state[1] |= 0xFFFFFFFF;
+	kbd_mod_state[2] |= 0xFFFFFFFF;
+}
+
+long kbd_is_key_pressed(long key)
+{
+	int i;
+	for (i=0;keymap[i].hackkey;i++){
+		if (keymap[i].hackkey == key){
+			return ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0) ? 1:0;
+		}
+	}
+	return 0;
+}
+
+long kbd_is_key_clicked(long key)
+{
+	int i;
+	for (i=0;keymap[i].hackkey;i++){
+		if (keymap[i].hackkey == key){
+			return ((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
+			       ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0);
+		}
+	}
+	return 0;
+}
+
+long kbd_get_pressed_key()
+{
+	int i;
+	for (i=0;keymap[i].hackkey;i++){
+		if ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0){
+			return keymap[i].hackkey;
+		}
+	}
+	return 0;
+}
+
+long kbd_get_clicked_key()
+{
+	int i;
+	for (i=0;keymap[i].hackkey;i++){
+		if (((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
+		    ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0)) {
+			return keymap[i].hackkey;
+		}
+	}
+	return 0;
+}
+
+
+
+void kbd_fetch_data(long *dst)
+{
+    // This seems to be very different from the other cameras I've seen.
+    // Keyboard data seems to be largely unavailable around 0xC0220200 (or in
+    // the entire 0xC0200000 range even), everything seems to happen in
+    // physw_status. Because of this (physw_status already filled), this function
+    // need not be called on S5IS. Candidate for removal if everyone agrees.
+    volatile long *mmio0 = (void*)0x11ABC;
+    volatile long *mmio1 = (void*)0x11AC0;
+    volatile long *mmio2 = (void*)0x11AC4;
+
+    dst[0] = *mmio0;
+    dst[1] = *mmio1;
+    dst[2] = *mmio2 ;
+}
+
+
+void kbd_reset_autoclicked_key() {
+	last_kbd_key = 0;
+}
+
+long kbd_get_autoclicked_key() {
+	static long last_kbd_time = 0, press_count = 0;
+	register long key, t;
+	
+	key=kbd_get_clicked_key();
+	if (key) {
+		last_kbd_key = key;
+		press_count = 0;
+		last_kbd_time = get_tick_count();
+		return key;
+	} else {
+		if (last_kbd_key && kbd_is_key_pressed(last_kbd_key)) {
+			t = get_tick_count();
+			if (t-last_kbd_time>((press_count)?175:500)) {
+				++press_count;
+				last_kbd_time = t;
+				return last_kbd_key;
+			} else {
+				return 0;
+			}
+		} else {
+			last_kbd_key = 0;
+			return 0;
+		}
+	}
+}
+
+long kbd_use_zoom_as_mf() {
+	static long zoom_key_pressed = 0;
+	
+	if (kbd_is_key_pressed(KEY_ZOOM_IN) && kbd_is_key_pressed(KEY_MF) && (mode_get()&MODE_MASK) == MODE_REC) {
+
+		if (shooting_get_focus_mode()) {
+			kbd_key_release_all();
+			kbd_key_press(KEY_UP);
+			kbd_key_press(KEY_MF);
+			zoom_key_pressed = KEY_ZOOM_IN;
+			return 1;
+		}
+	} else {
+		if (zoom_key_pressed==KEY_ZOOM_IN) {
+			kbd_key_release(KEY_UP);
+			kbd_key_release(KEY_MF);
+			zoom_key_pressed = 0;
+			return 1;
+		}
+	}
+	
+	if (kbd_is_key_pressed(KEY_ZOOM_OUT) && kbd_is_key_pressed(KEY_MF)  && (mode_get()&MODE_MASK) == MODE_REC) {
+		if (shooting_get_focus_mode()) {
+			kbd_key_release_all();
+			kbd_key_press(KEY_DOWN);
+			kbd_key_press(KEY_MF);
+			zoom_key_pressed = KEY_ZOOM_OUT;
+			return 1;
+		}
+	} else {
+		if (zoom_key_pressed==KEY_ZOOM_OUT) {
+			kbd_key_release(KEY_DOWN);
+			kbd_key_release(KEY_MF);
+			zoom_key_pressed = 0;
+			return 1;
+		}
+	}
+	return 0;
+}
+
+int get_usb_power(int edge)
+{
+	int x;
+
+	if (edge) return remote_key;
+	x = usb_power;
+	usb_power = 0;
+	return x;
+}
Index: /trunk/platform/s5is/wrappers.c
===================================================================
--- /trunk/platform/s5is/wrappers.c	(revision 511)
+++ /trunk/platform/s5is/wrappers.c	(revision 511)
@@ -0,0 +1,18 @@
+#include "../generic/wrappers.c"
+
+long lens_get_focus_pos()
+{
+	//return _GetFocusLensSubjectDistance();    // returns plaintext, calls GetCurrentTargetDistance to get value
+	return _GetCurrentTargetDistance(); 
+}
+
+long lens_get_focus_pos_from_lense()
+{
+	return _GetCurrentTargetDistance(); 
+	//return _GetFocusLensSubjectDistanceFromLens(); 
+}
+
+long lens_get_target_distance()
+{
+	return _GetCurrentTargetDistance();
+}
Index: /trunk/platform/s5is/main.c
===================================================================
--- /trunk/platform/s5is/main.c	(revision 511)
+++ /trunk/platform/s5is/main.c	(revision 511)
@@ -0,0 +1,132 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+#include "keyboard.h"
+
+
+extern long link_bss_start;
+extern long link_bss_end;
+extern void boot();
+
+
+void startup()
+{
+	long *bss = &link_bss_start;
+	long *ptr;
+	
+	// sanity check
+	if ((long)&link_bss_end > (MEMISOSTART + MEMISOSIZE)){
+		started();
+		shutdown();
+	}
+
+	// initialize .bss senment
+	while (bss<&link_bss_end)
+		*bss++ = 0;
+
+	boot();
+}
+
+
+static struct {
+	int hackmode;
+	int canonmode;
+} modemap[] = {
+	{ MODE_AUTO,               32768  },
+	{ MODE_P,                  32772  },
+	{ MODE_TV,                 32771  },
+	{ MODE_AV,                 32770  },
+	{ MODE_M,                  32769  },
+	{ MODE_PORTRAIT,           32781  },
+	{ MODE_NIGHT_SNAPSHOT,     32779  }, // not MODE_NIGHT? I changed it, camera says snapshot
+	{ MODE_LANDSCAPE,          32780  },
+	{ MODE_VIDEO_STD,          2594   },
+//	{ MODE_VIDEO_RECORDING,    3618   },
+	{ MODE_STITCH,             33290  },
+	{ MODE_MY_COLORS,          16923  }, // Is this SCN mode? (=color override)
+	{ MODE_SCN_NIGHT,          16398  },
+	{ MODE_SCN_INDOOR,         16401  },
+	{ MODE_SCN_FOLIAGE,        16402  },
+	{ MODE_SCN_SNOW,           16403  },
+	{ MODE_SCN_BEACH,          16404  },
+	{ MODE_SCN_FIREWORK,       16405  },
+	{ MODE_SCN_AQUARIUM,       16407  },
+	{ MODE_SCN_COLOR_ACCENT,   16922  }
+};
+#define MODESCNT (sizeof(modemap)/sizeof(modemap[0]))
+
+int mode_get() {
+	int mode, i, t=0xFF;
+	
+	volatile int *physw_mmio = (int *) 0xC0220200; // I don't know where else I can find this...
+	
+	mode  = (physw_mmio[1] & 0x00010000)?MODE_REC:MODE_PLAY;
+	mode |= (physw_status[1] & 0x00000100)?0:MODE_SCREEN_OPENED;
+	mode |= (physw_status[1] & 0x00000200)?0:MODE_SCREEN_ROTATED;
+	
+	_GetPropertyCase(49, &t, 4);
+	for (i=0; i<MODESCNT; ++i) {
+		if (modemap[i].canonmode == t) {
+			return (mode | (modemap[i].hackmode & MODE_SHOOTING_MASK));
+		}
+	}
+	return (mode);
+}
+
+static const struct {
+	int zp, fl;
+} fl_tbl[] = {
+	{   0,   6000 },
+	{  11,   6400 },
+	{  41,  12100 },
+	{  64,  21300 },
+	{  86,  41600 },
+	{ 105,  61400 },
+	{ 128,  72000 },
+};
+#define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0]))
+#define CF_EFL 6000
+
+const int zoom_points = 129;
+
+int get_effective_focal_length(int zp) {
+	return (CF_EFL*get_focal_length(zp))/1000;
+}
+
+int get_focal_length(int zp) {
+	int i;
+
+	if (zp<fl_tbl[0].zp)
+		return fl_tbl[0].fl;
+	else if (zp>fl_tbl[NUM_FL-1].zp)
+		return fl_tbl[NUM_FL-1].fl;
+	else 
+		for (i=1; i<NUM_FL; ++i) {
+			if (zp==fl_tbl[i-1].zp) 
+				return fl_tbl[i-1].fl;
+			else if (zp==fl_tbl[i].zp) 
+				return fl_tbl[i].fl;
+			else if (zp<fl_tbl[i].zp)
+				return fl_tbl[i-1].fl+(zp-fl_tbl[i-1].zp)*(fl_tbl[i].fl-fl_tbl[i-1].fl)/(fl_tbl[i].zp-fl_tbl[i-1].zp);
+		}
+	return fl_tbl[NUM_FL-1].fl;
+}
+
+int get_zoom_x(int zp) {
+	return get_focal_length(zp)*10/fl_tbl[0].fl;
+}
+
+long get_vbatt_min()
+{
+	return 4700;
+}
+
+long get_vbatt_max()
+{
+	return 5500;
+}
+
+void change_video_tables(int a, int b){
+	// Shuts up the compiler until video overrides are fixed for DryOS
+
+}
Index: /trunk/platform/s5is/notes.txt
===================================================================
--- /trunk/platform/s5is/notes.txt	(revision 511)
+++ /trunk/platform/s5is/notes.txt	(revision 511)
@@ -0,0 +1,12 @@
+****************************************
+
+Camera depending notes: 
+
+
+- s5is uses Propset 2 of Properties (see http://tinyurl.com/6zbv9b)
+- s5is does have a REAL IRIS Diaphragm, it does NOT have an an ND Filter! 
+Mind this.
+- DryOS Camera
+- Video Overrides and subsequently all things that have to do with video (remaining time etc) do NOT work as of now.
+
+
Index: /trunk/platform/s5is/lib.c
===================================================================
--- /trunk/platform/s5is/lib.c	(revision 511)
+++ /trunk/platform/s5is/lib.c	(revision 511)
@@ -0,0 +1,88 @@
+#include "platform.h"
+#include "lolevel.h"
+
+#define LED_PR 0xC02200D4
+
+void shutdown()
+{
+	volatile long *p = (void*)LED_PR;       // SD-write led on S5
+	
+	asm(
+		"MRS     R1, CPSR\n"
+		"AND     R0, R1, #0x80\n"
+		"ORR     R1, R1, #0x80\n"
+		"MSR     CPSR_cf, R1\n"
+		:::"r1","r0");
+	
+	*p = 0x44;  // led off.
+	
+	while(1);
+}
+
+
+#define LED_AF 0xC02200E0
+
+#define LED_BRIGHTNESS  200
+#define LED_GREEN       0
+#define LED_ORANGE      1
+#define LED_YELLOW      2 // LED_GREEN + LED_ORANGE
+#define LED_RED         3
+#define LED_BLUE        4
+#define LED_AF_BEAM     5 // Does not seem to accept any value.
+#define LED_TIMER       6
+
+static void led_on(const int led, const int brightness)
+{
+	if (led < 0 || led > 6 || led == LED_YELLOW) return;
+	static void* addr;
+	if(led == LED_AF_BEAM) { // does not accept anything (so it seems), bypass
+		*((long *) LED_AF) = 0x46;
+	} else {
+		addr = led_table + (led * 0x40) + 0x100;
+		_UniqueLedOn(addr,brightness);
+	}
+}
+ 
+static void led_off(const int led)
+{
+	if (led < 0 || led > 6 || led == LED_YELLOW) return;
+	static void* addr;
+	if(led == LED_AF_BEAM) { // does not accept anything (so it seems), bypass
+		*((long *) LED_AF) = 0x44;
+	} else {
+		addr = led_table + (led * 0x40) + 0x100;
+		_UniqueLedOff(addr);
+	}
+}
+
+void debug_led(int state)
+{
+	if (state)
+		led_on(LED_BLUE, LED_BRIGHTNESS);
+	else
+		led_off(LED_BLUE);
+}
+
+void ubasic_set_led(int led, int state, int bright)
+{
+	if (state) {
+		if (bright > LED_BRIGHTNESS) bright = LED_BRIGHTNESS;
+		if (led == LED_YELLOW) { // yellow = red + green
+			led_on(LED_GREEN, bright);
+			led_on(LED_ORANGE, bright);
+		} else {
+			led_on(led, bright);
+		}
+	} else {
+		if (led == LED_YELLOW) {
+			led_off(LED_GREEN);
+			led_off(LED_ORANGE);
+		} else {
+			led_off(led);
+		}
+	}
+}
+
+int get_flash_params_count(void){
+	return 111; // Found at ROM:FF972F9C (S5IS 1.01b)
+}
Index: /trunk/platform/s5is/sub/101a/capt_seq.c
===================================================================
--- /trunk/platform/s5is/sub/101a/capt_seq.c	(revision 511)
+++ /trunk/platform/s5is/sub/101a/capt_seq.c	(revision 511)
@@ -0,0 +1,1027 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+#define RAWDATA_AVAILABLE (1)
+#define RAWDATA_SAVED (2)
+
+#define NR_ON (2)
+#define NR_OFF (1)
+
+static long raw_save_stage;
+
+void capt_seq_hook_raw_here()
+{
+    raw_save_stage = RAWDATA_AVAILABLE;
+    core_rawdata_available();
+    while (raw_save_stage != RAWDATA_SAVED){
+	_SleepTask(10);
+    }
+}
+
+void hook_raw_save_complete()
+{
+    raw_save_stage = RAWDATA_SAVED;
+}
+
+
+void capt_seq_hook_set_nr()
+{
+    long *nrflag = (long*)0xB704;
+
+    switch (core_get_noise_reduction_value()){
+    case NOISE_REDUCTION_AUTO_CANON:
+	// leave it alone
+	break;
+    case NOISE_REDUCTION_OFF:
+	*nrflag = 1;
+	break;
+    case NOISE_REDUCTION_ON:
+	*nrflag = 2;
+	break;
+    };
+}
+
+
+///////////////////////////////////////////////
+// Captseqtask bypass
+// Functions are left intact, no jumps back to original firmware. Code is
+// currently 40 kB (including comments, whitespace and such), about 11 kB 
+// (including comments, whitespace and such) can be saved, so roughly 1/4.
+// This is probably not worth it, as full functions might make debugging easier.
+///////////////////////////////////////////////
+
+void __attribute__((naked,noinline)) sub_FF826A50_my() { // called from init things
+     asm volatile (
+          "STMFD   SP!, {R4,LR}\n"
+          "LDR     R4, =0x1D6C\n"
+          "MOV     R0, #0\n"
+          "MOV     R1, #4\n"
+          "STR     R0, [R4,#8]\n"
+          "BL      sub_FF81BCF4\n"
+          "STR     R0, [R4]\n"
+          "MOV     R0, #0\n"
+          "MOV     R1, #1\n"
+          "BL      sub_FF81BD18\n"
+          "STR     R0, [R4,#4]\n"
+          "BL      sub_FF869CD0\n"
+          "BL      sub_FF868B08\n"
+//          "BL      sub_FF865D68\n"               // Taskcreate_captseqtask called from this one
+          "BL      sub_FF865D68_my\n"               // Taskcreate_captseqtask called from this one
+          "BL      sub_FF869F98\n"
+          "LDR     R0, [R4]\n"
+          "LDMFD   SP!, {R4,LR}\n"
+          "MOV     R1, #0x1000\n"
+          "B       sub_FF82A33C\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF865D68_my() {
+     asm volatile (
+
+          "STMFD   SP!, {R3-R5,LR}\n"
+          "LDR     R4, =0x59AC\n"
+          "LDR     R0, [R4,#0x20]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF865E3C\n"
+          //"BL      nullsub_20\n"
+          "MOV     R1, #1\n"
+          "MOV     R0, #0\n"
+          "BL      sub_FF81BD18\n"
+          "STR     R0, [R4,#0x38]\n"
+          "MOV     R0, #0\n"
+          "MOV     R1, #0\n"
+          "BL      sub_FF81BCF4\n"
+          "STR     R0, [R4,#0x3C]\n"
+          "BL      sub_FF86614C\n"
+          "MOV     R1, #0x14\n"
+          "MOV     R0, #0\n"
+          "BL      sub_FF81BCD0\n"
+          "STR     R0, [R4,#0x2C]\n"
+          "MOV     R0, #0\n"
+          "MOV     R1, #1\n"
+          "BL      sub_FF81BD18\n"
+          "MOV     R1, #0\n"
+          "STR     R0, [R4]\n"
+          "BL      sub_FF81B860\n" // TakeSemaphore
+          "LDR     R1, =0x1AA6C\n"
+          "MOV     R0, #0\n"
+          "MOV     R5, #0\n"
+
+     "loc_FF865DD8:\n"                           // CODE XREF: sub_FF865D68+80j
+          "ADD     R2, R1, R0,LSL#4\n"
+          "ADD     R0, R0, #1\n"
+          "CMP     R0, #6\n"
+          "STR     R5, [R2,#0xC]\n"
+          "BCC     loc_FF865DD8\n"
+          "STR     R5, [R4,#0x30]\n"
+          "LDR     R0, [R4]\n"
+          "BL      sub_FF81B930\n" // GiveSemaphore
+          "MOV     R3, #0\n"
+          "STR     R3, [SP,#0x10-0x10]\n"
+          //"ADR     R3, ShootSeqTask\n"
+          "LDR     R3, =0xFF865CEC\n" // ShootSeqTask
+          "MOV     R2, #0x1000\n"
+          "MOV     R1, #0x17\n"
+          //"ADR     R0, aShootseqtask\n"          // \"ShootSeqTask\"
+          "LDR     R0, =0xFF866050\n" // aShootseqtask
+          "BL      sub_FF81BC9C\n"
+          "LDR     R0, =0x59EC\n"
+          "MOV     R1, #0\n"
+          "STR     R5, [R4,#0x34]\n"
+          "STR     R1, [R0],#4\n"
+          "STR     R1, [R0]\n"
+          "BL      sub_FF866404\n"
+          "BL      sub_FF86A128\n"
+          "BL      sub_FF868504\n"
+//          "BL      sub_FF867014\n" // taskcreate_CaptSeqTask
+          "BL      sub_FF867014_my\n" // bypass taskcreate_CaptSeqTask
+          "BL      sub_FF867E24\n"
+
+     "loc_FF865E3C:\n"                           // CODE XREF: sub_FF865D68+10j
+          "MOV     R0, #1\n"
+          "STR     R0, [R4,#0x20]\n"
+          "LDMFD   SP!, {R3-R5,PC}\n"
+
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF867014_my() {
+     asm volatile (
+          "STMFD   SP!, {R3-R5,LR}\n"
+          "LDR     R2, =0x1AC04\n"
+          "MOV     R0, #0\n"
+          "MOV     R1, #0\n"
+
+     "loc_FF867024:\n"                           // CODE XREF: taskcreate_CaptSeqTask+20j
+          "ADD     R3, R2, R0,LSL#4\n"
+          "ADD     R0, R0, #1\n"
+          "CMP     R0, #5\n"
+          "STR     R1, [R3,#8]\n"
+          "BCC     loc_FF867024\n"
+          "LDR     R0, =0x1AC54\n"
+          "STR     R1, [R0,#8]\n"
+          "ADD     R0, R0, #0x10\n"
+          "STR     R1, [R0,#8]\n"
+          "BL      sub_FF95F6D4\n"
+          "BL      sub_FF961960\n"
+          "MOV     R1, #5\n"
+          "MOV     R0, #0\n"
+          "BL      sub_FF81BCD0\n"
+          "LDR     R4, =0x5A14\n"
+          "LDR     R1, =0x1001FF\n"
+          "STR     R0, [R4,#0x14]\n"
+          "MOV     R0, #0\n"
+          "BL      sub_FF81BCF4\n"
+          "STR     R0, [R4,#0x10]\n"
+          "MOV     R3, #0\n"
+          "STR     R3, [SP,#0x10-0x10]\n"
+          //"ADR     R3, CaptSeqTask\n"
+          "ADR     R3, sub_FF866D48_my\n" // bypass CaptSeqTask
+          //"ADR     R0, aCaptseqtask\n"           // \"CaptSeqTask\"
+          "LDR     R0, =0xFF867228\n" // "CaptSeqTask"
+          "MOV     R2, #0x1000\n"
+          "MOV     R1, #0x17\n"
+          "BL      sub_FF81BC9C\n"
+          "LDMFD   SP!, {R3-R5,PC}\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF866D48_my() {
+     asm volatile (
+          "STMFD   SP!, {R3-R9,LR}\n"
+          "LDR     R6, =0x1AC98\n"
+          "LDR     R5, =0x5A14\n"
+          "MOV     R9, #1\n"
+          "MOV     R7, #0\n"
+
+     "loc_FF866D5C:\n"                           // CODE XREF: CaptSeqTask+2C8j
+          "LDR     R0, [R5,#0x14]\n"
+          "MOV     R2, #0\n"
+          "MOV     R1, SP\n"
+          "BL      sub_FF82A5C0\n"
+          "TST     R0, #1\n"
+          "BEQ     loc_FF866D88\n"
+          "LDR     R1, =0x415\n"
+          "LDR     R0, =0xFF8667C8\n" //aSsshoottask_c\n"
+          "BL      sub_FF81BD94\n" //assert\n"
+          "BL      sub_FF81BC54\n" //ExitTask\n"
+          "LDMFD   SP!, {R3-R9,PC}\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866D88:\n"                           // CODE XREF: CaptSeqTask+28j
+          "LDR     R0, [SP,#0x20-0x20]\n"
+          "LDR     R1, [R0]\n"
+          "CMP     R1, #0x1B\n"
+          "ADDLS   PC, PC, R1,LSL#2\n"
+          "B       loc_FF866FD8\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866D9C:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866E0C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DA0:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866E7C\n"													// Entry 1: After shooting, while doing darkframesub (after shutter button?)
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DA4:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866E84\n"													// Entry 2: After shutter button release when already done shooting pic
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DA8:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866E9C\n"													// Entry 3: If shutter button not pressed
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DAC:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866E90\n"													// Entry 4: In timed image review
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DB0:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866EA4\n"													// Entry 5: In detailed image review
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DB4:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866EAC\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DB8:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866EB4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DBC:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866F0C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DC0:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866F18\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DC4:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866F20\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DC8:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866F28\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DCC:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866F30\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DD0:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866F38\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DD4:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866F40\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DD8:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866F48\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DDC:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866F50\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DE0:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866F58\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DE4:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866F60\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DE8:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866F68\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DEC:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866F70\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DF0:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866F7C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DF4:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866F88\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DF8:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866F90\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DFC:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866FC0\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866E00:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866FC8\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866E04:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866FD0\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866E08:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866E0C:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 0\n"
+          "BL      sub_FF95F190\n"
+          "BL      sub_FF864C5C\n"
+          "LDR     R0, [R6,#0x24]\n"
+          "CMP     R0, #0\n"
+          "BEQ     loc_FF866FE4\n"
+          "BL      sub_FF8664A0\n"
+          "MOV     R4, R0\n"
+          "LDR     R0, [R6,#0x24]\n"
+          "CMP     R0, #0\n"
+          "BEQ     loc_FF866E54\n"
+          "MOV     R0, #0xC\n"
+          "BL      sub_FF869C60\n"
+          "TST     R0, #1\n"
+          "STRNE   R9, [R5,#4]\n"
+          "LDRNE   R0, [R4,#8]\n"
+          "ORRNE   R0, R0, #0x40000000\n"
+          "STRNE   R0, [R4,#8]\n"
+          "BNE     loc_FF866FE4\n"
+
+     "loc_FF866E54:\n"                           // CODE XREF: CaptSeqTask+E8j
+          "MOV     R0, R4\n"
+          "BL      sub_FF960B34\n"
+          "BL      sub_FF9733B8\n"
+          "BL      sub_FF8749E4\n"
+          "STR     R0, [R4,#0x14]\n"
+          "MOV     R0, R4\n"
+          "BL      sub_FF961054\n"
+          "TST     R0, #1\n"
+          "STRNE   R9, [R5,#4]\n"
+          "B       loc_FF866FE4\n"
+
+     "loc_FF866E7C:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 1\n"       // According to the A720IS firmware, this is done after relasing the shutter (button?)
+//          "BL      sub_FF866844\n"             // Bypass this and the camera will not properly shoot a picture, it will beep after a bit
+          "BL      sub_FF866844_my\n"
+          "B       loc_FF866E94\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866E84:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 2\n"
+          "MOV     R0, #1\n"
+          "BL      sub_FF95F3D8\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866E90:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 4\n"
+          "BL      sub_FF95EF2C\n"
+
+     "loc_FF866E94:\n"                           // CODE XREF: CaptSeqTask+138j
+          "STR     R7, [R6,#0x24]\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866E9C:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 3\n"       // Points to prepareseq.c
+          "BL      sub_FF95F15C\n"
+          "B       loc_FF866E94\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866EA4:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 5\n"       // Points to prepareseq.c
+          "BL      sub_FF95F164\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866EAC:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 6\n"
+          "BL      sub_FF95F2C4\n"
+          "B       loc_FF866F10\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866EB4:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 7\n"
+          "LDR     R4, [R0,#0xC]\n"
+          "BL      sub_FF95F16C\n" //UiEvnt_StartDisguiseCradleStatus_4\n"
+          "MOV     R0, R4\n"
+          "BL      sub_FF95FC9C\n"
+          "TST     R0, #1\n"
+          "MOV     R8, R0\n"
+          "BNE     loc_FF866EF4\n"
+          "BL      sub_FF8749E4\n"
+          "STR     R0, [R4,#0x14]\n"
+          "MOV     R0, R4\n"
+          "BL      sub_FF960F84\n"
+          "MOV     R0, R4\n"
+          "BL      sub_FF96143C\n"
+          "MOV     R8, R0\n"
+          "LDR     R0, [R4,#0x14]\n"
+          "BL      sub_FF874BD8\n"
+
+     "loc_FF866EF4:\n"                           // CODE XREF: CaptSeqTask+184j
+          "BL      sub_FF95F15C\n"
+          "MOV     R2, R4\n"
+          "MOV     R1, #7\n"
+          "MOV     R0, R8\n"
+          "BL      sub_FF865098\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866F0C:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 8\n"
+          "BL      sub_FF95F354\n"
+
+     "loc_FF866F10:\n"                           // CODE XREF: CaptSeqTask+168j
+          "BL      sub_FF864C5C\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866F18:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 9\n"
+          "BL      sub_FF95F15C\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866F20:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 10\n"
+          "BL      sub_FF95FEE8\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866F28:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 11\n"
+          "BL      sub_FF9600E4\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866F30:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 12\n"
+          "BL      sub_FF9601C8\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866F38:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 13\n"
+          "BL      sub_FF96027C\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866F40:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 14\n"
+          "BL      sub_FF9606E0\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866F48:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 15\n"
+          "BL      sub_FF960724\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866F50:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 16\n"
+          "MOV     R0, #0\n"
+          "B       loc_FF866F74\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866F58:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 17\n"
+          "BL      sub_FF960898\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866F60:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 18\n"
+          "BL      sub_FF96092C\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866F68:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 19\n"
+          "BL      sub_FF9609E0\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866F70:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 20\n"
+          "MOV     R0, #1\n"
+
+     "loc_FF866F74:\n"                           // CODE XREF: CaptSeqTask+20Cj
+          "BL      sub_FF960778\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866F7C:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 21\n"
+          "BL      sub_FF95F574\n"
+          "BL      sub_FF8670FC\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866F88:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 22\n"
+          "BL      sub_FF9604F4\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866F90:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 23\n"
+          "MOV     R2, #2\n"
+          "ADD     R1, R6, #0x58\n"
+          "MOV     R0, #0x6F\n"
+          "BL      sub_FF874864\n"
+          "TST     R0, #1\n"
+          "LDRNE   R0, =0xFF8667C8\n" //aSsshoottask_c\n"
+          "MOVNE   R1, #0x4D0\n"
+          "BLNE    sub_FF81BD94\n" //assert\n"
+          "LDRH    R0, [R6,#0x58]\n"
+          "CMP     R0, #1\n"
+          "BLEQ    sub_FF9604E8\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866FC0:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 24\n"
+          "BL      sub_FF96062C\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866FC8:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 25\n"
+          "BL      sub_FF86672C\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866FD0:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 26\n"
+          "BL      sub_FF8269C4\n"
+          "B       loc_FF866FE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866FD8:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 default entry\n"
+          "LDR     R1, =0x4F1\n"
+          "LDR     R0, =0xFF8667C8\n" //aSsshoottask_c\n"
+          "BL      sub_FF81BD94\n" //assert\n"
+
+     "loc_FF866FE4:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866D94 entry 27\n"
+          "LDR     R0, [SP,#0x20-0x20]\n"
+          "LDR     R1, [R0,#4]\n"
+          "LDR     R0, [R5,#0x10]\n"
+          "BL      sub_FF82A33C\n"
+          "LDR     R4, [SP,#0x20-0x20]\n"
+          "LDR     R0, [R4,#8]\n"
+          "CMP     R0, #0\n"
+          "LDREQ   R0, =0xFF8667C8\n" //aSsshoottask_c\n"
+          "MOVEQ   R1, #0xF7\n"
+          "BLEQ    sub_FF81BD94\n" //assert\n"
+          "STR     R7, [R4,#8]\n"
+          "B       loc_FF866D5C\n"
+     ".ltorg\n"
+     );
+}
+
+
+void __attribute((naked,noinline)) sub_FF866844_my() {
+     asm volatile (
+          "STMFD   SP!, {R4-R8,LR}\n"
+          "LDR     R4, [R0,#0xC]\n"
+          "LDR     R5, =0x1AC98\n"
+          "LDR     R0, [R4,#8]\n"
+          "LDR     R6, =0x820A\n"
+          "ORR     R0, R0, #1\n"
+          "STR     R0, [R4,#8]\n"
+          "LDRH    R0, [R5]\n"
+          "LDR     R8, =0x5A14\n"
+          "MOV     R7, #0\n"
+          "CMP     R0, R6\n"
+          "BEQ     loc_FF8668E8\n"
+          "LDRH    R0, [R5,#0x88]\n"
+          "CMP     R0, #3\n"
+          "BEQ     loc_FF86693C\n"
+          "LDR     R0, [R4,#0xC]\n"
+          "CMP     R0, #1\n"
+          "BLS     loc_FF8668F4\n"
+          "LDRH    R0, [R5,#0x86]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF86693C\n"
+          "LDRH    R0, [R5,#0x82]\n"
+          "CMP     R0, #2\n"
+          "BNE     loc_FF866900\n"
+          "BL      sub_FF95F628\n"
+          "LDRH    R0, [R5]\n"
+          "CMP     R0, R6\n"
+          "BEQ     loc_FF8668E8\n"
+          "LDRH    R0, [R5,#0x88]\n"
+          "CMP     R0, #3\n"
+          "BEQ     loc_FF86693C\n"
+          "LDR     R0, [R4,#0xC]\n"
+          "CMP     R0, #1\n"
+          "BLS     loc_FF8668F4\n"
+          "LDRH    R0, [R5,#0x86]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF86693C\n"
+          "LDRH    R0, [R5,#0x82]\n"
+          "CMP     R0, #2\n"
+          "BEQ     loc_FF86692C\n"
+          "B       loc_FF866900\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF8668E8:\n"                           // CODE XREF: sub_FF866844+2Cj
+          " \n"                                  // sub_FF866844+6Cj
+          "LDRH    R0, [R5,#0x88]\n"
+          "CMP     R0, #3\n"
+          "BEQ     loc_FF86693C\n"
+
+     "loc_FF8668F4:\n"                           // CODE XREF: sub_FF866844+44j
+          " \n"                                  // sub_FF866844+84j
+          "LDRH    R0, [R5,#0x86]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF86693C\n"
+
+     "loc_FF866900:\n"                           // CODE XREF: sub_FF866844+5Cj
+          " \n"                                  // sub_FF866844+A0j
+          "LDRH    R0, [R5,#0x82]\n"
+          "CMP     R0, #1\n"
+          "BNE     loc_FF86693C\n"
+          "LDRH    R0, [R5]\n"
+          "CMP     R0, R6\n"
+          "LDRNE   R0, [R4,#0xC]\n"
+          "CMPNE   R0, #1\n"
+          "BLS     loc_FF86693C\n"
+          "LDR     R0, [R4,#0x10]\n"
+          "CMP     R0, #1\n"
+          "BNE     loc_FF86693C\n"
+
+     "loc_FF86692C:\n"                           // CODE XREF: sub_FF866844+9Cj
+          "LDR     R2, =0xEA60\n"
+          "LDR     R0, [R8,#0x10]\n"
+          "MOV     R1, #0x40000000\n"
+          "BL      sub_FF869FC0\n"
+
+     "loc_FF86693C:\n"                           // CODE XREF: sub_FF866844+38j
+          " \n"                                  // sub_FF866844+50j ...
+          "BL      sub_FF86672C\n"
+          "LDR     R0, [R5,#0x24]\n"
+          "CMP     R0, #0\n"
+          "MOVEQ   R0, #2\n"
+          "BLEQ    sub_FF85FD44\n"
+          "BL      sub_FF95F16C\n" // UiEvnt_StartDisguiseCradleStatus_4\n"
+          "LDR     R0, [R4,#0x18]\n"
+          "CMP     R0, #0\n"
+          "BLNE    sub_FF861FF0\n"
+          "LDR     R0, [R5,#0x24]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF8669B8\n"
+          "MOV     R0, R4\n"
+          "BL      sub_FF960B34\n"
+          "MOV     R0, R4\n"
+          "BL      sub_FF95F8B8\n"
+          "TST     R0, #1\n"
+          "MOVNE   R2, R4\n"
+//          "LDMFDNE SP!, {R4-R8,LR}\n"
+          "LDMNEFD SP!, {R4-R8,LR}\n"
+          "MOVNE   R1, #1\n"
+          "BNE     sub_FF865098\n"
+          "BL      sub_FF9733B8\n"
+
+          "BL      shooting_expo_param_override\n"  // +-----------> Override Canon stuff :)
+
+          "BL      sub_FF8749E4\n"
+          "STR     R0, [R4,#0x14]\n"
+          "MOV     R0, R4\n"
+          "BL      sub_FF960F84\n"
+          "BL      sub_FF961874\n"
+          "MOV     R0, R4\n"
+//          "BL      sub_FF961054\n" // This is where shooting AND darkframe sub is done
+          "BL      sub_FF961054_my\n" // so hook it
+          "MOV     R7, R0\n"
+
+          "BL      capt_seq_hook_raw_here\n" // +-----------> Capture RAW, camera already did badpixel-sub (always) though some pixels are still there
+
+          "B       loc_FF8669C4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF8669B8:\n"                           // CODE XREF: sub_FF866844+124j
+          "LDR     R0, [R8,#4]\n"
+          "CMP     R0, #0\n"
+          "MOVNE   R7, #0x1D\n"
+
+     "loc_FF8669C4:\n"                           // CODE XREF: sub_FF866844+170j
+          "MOV     R2, R4\n"
+          "MOV     R1, #1\n"
+          "MOV     R0, R7\n"
+          "BL      sub_FF865098\n"
+          "BL      sub_FF9613DC\n"
+          "CMP     R0, #0\n"
+          "LDRNE   R0, [R4,#8]\n"
+          "ORRNE   R0, R0, #0x2000\n"
+          "STRNE   R0, [R4,#8]\n"
+          "LDR     R0, [R4,#0x18]\n"
+          "CMP     R0, #0\n"
+          "BLNE    sub_FF862008\n"
+          "LDRH    R0, [R5,#0x88]\n"
+          "CMP     R0, #3\n"
+//          "LDMFDEQ SP!, {R4-R8,PC}\n"
+          "LDMEQFD SP!, {R4-R8,PC}\n"
+          "LDRH    R0, [R5,#0x86]\n"
+          "CMP     R0, #0\n"
+//          "LDRHEQ  R0, [R5,#0x82]\n"
+          "LDREQH  R0, [R5,#0x82]\n"
+          "CMPEQ   R0, #2\n"
+          "MOVEQ   R0, R4\n"
+//          "LDMFDEQ SP!, {R4-R8,LR}\n"
+          "LDMEQFD SP!, {R4-R8,LR}\n"
+          "BEQ     sub_FF95F670\n"
+          "LDMFD   SP!, {R4-R8,PC}\n"
+	".ltorg\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF961054_my() {
+     asm volatile (
+          "STMFD   SP!, {R0-R8,LR}\n"
+          "MOV     R4, R0\n"
+          "BL      sub_FF9619B0\n"
+          "MVN     R1, #0\n"
+          "BL      sub_FF82A370\n"
+          "MOV     R2, #4\n"
+          "ADD     R1, SP, #0x28-0x20\n"
+          "MOV     R0, #0x8A\n"
+          "BL      sub_FF874864\n"
+          "TST     R0, #1\n"
+          "LDRNE   R1, =0x1D2\n"
+//          "ADRNE   R0, aSscaptureseq_c\n"        // \"SsCaptureSeq.c\"
+          "LDRNE   R0, =0xFF96126C\n"
+          "BLNE    sub_FF81BD94\n" // assert\n"
+          "LDR     R6, =0x1AD48\n"
+          "LDR     R7, =0x1AC98\n"
+          "LDRSH   R1, [R6,#0xE]\n"
+          "LDR     R0, [R7,#0x7C]\n"
+//          "BL      nullsub_70\n"
+          "BL      sub_FF8505BC\n" //GetCCDTemperature\n"
+          "LDR     R2, =0xB708\n"
+          "ADD     R3, R4, #0x78\n"
+          "STRH    R0, [R4,#0x74]\n"
+//          "STRD    R2, [SP,#0x28-0x28]\n"  // WORKSFORME, configure gcc WITHOUT --with-cpu=arm9
+          "STR    R2, [SP,#0x28-0x28]\n"     // Though use the old, 2-line version
+          "STR    R3, [SP,#0x28-0x24]\n"     // for the final until everyone uses 'new' gcc
+          "MOV     R1, R0\n"
+          "LDRH    R0, [R7,#0x54]\n"
+          "LDRSH   R2, [R6,#0xC]\n"
+          "LDR     R3, =0xB704\n"
+
+          "BL      sub_FFA40388\n" // 2 (NR) is set into 0xB704 in this sub! Still before shooting
+
+          "BL      wait_until_remote_button_is_released\n"
+          "BL      capt_seq_hook_set_nr\n" // +-----------> so immediately override NR
+
+          "LDR     R0, [R4,#0x18]\n"
+          "LDR     R1, =0xB704\n"
+          "CMP     R0, #0\n"
+          "MOV     R8, #1\n"
+          "BEQ     loc_FF9610E4\n"
+          "LDR     R0, [R1]\n"
+          "CMP     R0, #2\n"
+          "STREQ   R8, [R1]\n"
+
+     "loc_FF9610E4:\n"                           // CODE XREF: sub_FF961054+80j
+          "LDR     R0, [R1,#4]\n"
+          "MOV     R5, R1\n"
+          "BL      sub_FF850AD8\n"
+          "LDR     R0, [R5]\n"
+          "MOV     R1, #0\n"
+          "CMP     R0, #1\n"
+          "BNE     loc_FF96115C\n"
+          "STR     R1, [SP,#0x28-0x1C]\n"
+          "LDR     R0, [R4,#0x14]\n"
+          "MOV     R1, #0x33\n"
+          "MOV     R3, #2\n"
+          "ADD     R2, SP, #0x28-0x1C\n"
+          "BL      sub_FF874CD0\n"
+          "LDR     R0, [R4,#8]\n"
+//          "ADR     R3, sub_FF960DE8\n"
+          "LDR     R3, =0xFF960DE8\n"
+          "ORR     R0, R0, #0x40\n"
+          "STR     R0, [R4,#8]\n"
+          "LDR     R0, [SP,#0x28-0x20]\n"
+          "STR     R4, [SP,#0x28-0x28]\n"
+          "CMP     R0, #0\n"
+          "LDR     R0, [R4,#0x24]\n"
+          "MOV     R2, R4\n"
+//          "ADR     R1, sub_FF960D68\n"
+          "LDR     R1, =0xFF960D68\n"
+          "BEQ     loc_FF96114C\n"
+          "BL      sub_FF9D03DC\n"
+          "B       loc_FF961150\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF96114C:\n"                           // CODE XREF: sub_FF961054+ECj
+          "BL      sub_FF8BA418\n"
+
+     "loc_FF961150:\n"                           // CODE XREF: sub_FF961054+F4j
+          " \n"                                  // sub_FF961054+2ACj ...
+          "TST     R0, #1\n"
+          "BEQ     loc_FF961324\n"
+          "B       loc_FF96130C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF96115C:\n"                           // CODE XREF: sub_FF961054+A8j
+          "CMP     R0, #2\n"
+          "BNE     loc_FF9612AC\n"
+          "STR     R1, [SP,#0x28-0x28+4]\n" // start shooting with darkframe
+          "STR     R8, [SP,#0x28-0x1C]\n"
+          "LDR     R0, [R4,#0x14]\n"
+          "MOV     R1, #0x33\n"
+          "MOV     R3, #2\n"
+          "ADD     R2, SP, #0x28-0x1C\n"
+          "BL      sub_FF874CD0\n"
+          "LDR     R0, [R4,#8]\n"
+          "LDR     R1, =0xFF960D68\n"
+          "ORR     R0, R0, #0x80\n"
+          "STR     R0, [R4,#8]\n"
+          "LDR     R0, [SP,#0x28-0x20]\n"
+          "STR     R4, [SP,#0x28-0x28]\n"
+          "CMP     R0, #0\n"
+          "LDR     R0, [R4,#0x24]\n"
+//          "ADR     R3, locret_FF960E78\n"
+          "LDR     R3, =0xFF960F40\n"
+          "MOV     R2, R4\n"
+          "BEQ     loc_FF9611B4\n"
+          "BL      sub_FF9D03E4\n"
+          "B       loc_FF9611B8\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF9611B4:\n"                           // CODE XREF: sub_FF961054+154j
+          "BL      sub_FF8BA498\n"
+
+     "loc_FF9611B8:\n"                           // CODE XREF: sub_FF961054+15Cj
+          "TST     R0, #1\n"
+          "BNE     loc_FF96130C\n"
+          "MOV     R1, #0\n"
+          "MOV     R0, #0x44\n"
+          "BL      sub_FF886C08\n"
+          "LDR     R0, [R4,#8]\n"
+          "ORR     R0, R0, #0x100\n"
+          "STR     R0, [R4,#8]\n"
+          "BL      sub_FF8BA414\n"
+          "LDR     R0, [SP,#0x28-0x20]\n"
+          "LDR     R1, =0xFF960DE8\n"
+          "CMP     R0, #0\n"
+          "LDR     R0, [R4,#0x24]\n"
+          "MOV     R2, R4\n"
+          "BEQ     loc_FF9611FC\n"
+          "BL      sub_FF9D03F4\n"
+          "B       loc_FF961200\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF9611FC:\n"                           // CODE XREF: sub_FF961054+19Cj
+          "BL      sub_FF8BA5C4\n"
+
+     "loc_FF961200:\n"                           // CODE XREF: sub_FF961054+1A4j
+          "TST     R0, #1\n"
+          "BNE     loc_FF96130C\n"
+          "MOV     R2, #2\n"
+          "ADD     R1, SP, #0x28-0x28+4\n"
+          "MOV     R0, #0xD8\n"
+          "BL      sub_FF874864\n"
+          "TST     R0, #1\n"
+          "LDRNE   R1, =0x24E\n"
+//          "ADRNE   R0, aSscaptureseq_c\n"        // \"SsCaptureSeq.c\"
+          "LDRNE   R0, =0xFF96126C\n"
+          "BLNE    sub_FF81BD94\n" // assert\n"
+          "LDR     R0, [R4,#0x78]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF961324\n"
+          "LDR     R0, [R6]\n"
+          "CMP     R0, #0\n"
+          "BEQ     loc_FF96124C\n"
+          "LDRH    R0, [SP,#0x28-0x28+4]\n"
+          "CMP     R0, #1\n"
+          "BEQ     loc_FF961324\n"
+
+     "loc_FF96124C:\n"                           // CODE XREF: sub_FF961054+1E8j
+          "MOV     R1, #0\n"
+          "MOV     R0, #0x45\n"
+          "BL      sub_FF886C08\n"
+          "B       loc_FF961324\n"
+          "@ ---------------------------------------------------------------------------\n"
+          
+          ".ltorg\n" // Shut up stupid compiler/assembler manually
+          
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF9612AC:\n"                           // CODE XREF: sub_FF961054+10Cj
+          "CMP     R0, #3\n"
+          "BNE     loc_FF961318\n"
+          "MOV     R0, #2\n"
+          "STR     R0, [SP,#0x28-0x1C]\n"
+          "LDR     R0, [R4,#0x14]\n"
+          "MOV     R3, #2\n"
+          "ADD     R2, SP, #0x28-0x1C\n"
+          "MOV     R1, #0x33\n"
+          "BL      sub_FF874CD0\n"
+          "LDR     R0, [R4,#8]\n"
+          "LDR     R3, =0xFF960DE8\n"
+          "ORR     R0, R0, #0x200\n"
+          "STR     R0, [R4,#8]\n"
+          "LDR     R0, [SP,#0x28-0x20]\n"
+          "STR     R4, [SP,#0x28-0x28]\n"
+          "CMP     R0, #0\n"
+          "LDR     R0, [R4,#0x24]\n"
+          "LDR     R1, =0xFF960D68\n"
+          "MOV     R2, R4\n"
+          "BEQ     loc_FF961304\n"
+          "BL      sub_FF9D03EC\n"
+          "B       loc_FF961150\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF961304:\n"                           // CODE XREF: sub_FF961054+2A4j
+          "BL      sub_FF8BA544\n"
+          "B       loc_FF961150\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF96130C:\n"                           // CODE XREF: sub_FF961054+104j
+          " \n"                                  // sub_FF961054+168j ...
+          "MOV     R0, #0x1D\n"
+
+     "loc_FF961310:\n"                           // CODE XREF: sub_FF961054+384j
+          "ADD     SP, SP, #0x10\n"
+          "LDMFD   SP!, {R4-R8,PC}\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF961318:\n"                           // CODE XREF: sub_FF961054+25Cj
+          "LDR     R1, =0x279\n"
+//          "ADR     R0, aSscaptureseq_c\n"        // \"SsCaptureSeq.c\"
+          "LDR     R0, =0xFF96126C\n"
+          "BL      sub_FF81BD94\n" //assert\n"
+
+     "loc_FF961324:\n"                           // CODE XREF: sub_FF961054+100j
+          " \n"                                  // sub_FF961054+1DCj ...
+          "LDR     R2, =0xB708\n"
+          "LDR     R0, [R4,#0x14]\n"
+          "MOV     R3, #4\n"
+          "MOV     R1, #0x45\n"
+          "BL      sub_FF874CD0\n"
+          "MOV     R0, #1\n"
+          "BL      sub_FF91C114\n"
+          "STR     R0, [R4,#0x98]\n"
+          "BL      sub_FF868688\n"
+          "LDRH    R0, [R7]\n"
+          "LDR     R12, =0x820A\n"
+          "CMP     R0, R12\n"
+//          "LDRHNE  R0, [R7,#0x88]\n"
+          "LDRNEH  R0, [R7,#0x88]\n"
+          "MOVNE   R1, R7\n"
+          "CMPNE   R0, #3\n"
+          "LDRNE   R0, [R4,#0xC]\n"
+          "CMPNE   R0, #1\n"
+          "BLS     loc_FF9613B4\n"
+          "LDRH    R2, [R1,#0x86]\n"
+          "CMP     R2, #0\n"
+          "BNE     loc_FF961398\n"
+          "LDRH    R0, [R1,#0x82]\n"
+          "CMP     R0, #1\n"
+          "CMPNE   R0, #2\n"
+          "BEQ     loc_FF961398\n"
+          "CMP     R0, #3\n"
+//          "LDRHEQ  R0, [R1,#0x8A]\n"
+          "LDREQH  R0, [R1,#0x8A]\n"
+          "CMPEQ   R0, #2\n"
+          "BNE     loc_FF9613D4\n"
+
+     "loc_FF961398:\n"                           // CODE XREF: sub_FF961054+320j
+          " \n"                                  // sub_FF961054+330j
+          "LDR     R0, [R4,#0x10]\n"
+          "CMP     R0, #1\n"
+          "BEQ     loc_FF9613B4\n"
+          "CMP     R2, #0\n"
+//          "LDRHEQ  R0, [R1,#0x82]\n"
+          "LDREQH  R0, [R1,#0x82]\n"
+          "CMPEQ   R0, #2\n"
+          "BNE     loc_FF9613D4\n"
+
+     "loc_FF9613B4:\n"                           // CODE XREF: sub_FF961054+314j
+          " \n"                                  // sub_FF961054+34Cj
+          "BL      sub_FF9619B0\n"
+          "LDR     R2, =0x2710\n"
+          "MOV     R1, #4\n"
+          "BL      sub_FF869FC0\n"
+          "CMP     R0, #0\n"
+          "LDRNE   R1, =0x286\n"
+//          "ADRNE   R0, aSscaptureseq_c\n"        // \"SsCaptureSeq.c\"
+          "LDRNE   R0, =0xFF96126C\n"
+          "BLNE    sub_FF81BD94\n" // assert\n"
+
+     "loc_FF9613D4:\n"                           // CODE XREF: sub_FF961054+340j
+          " \n"                                  // sub_FF961054+35Cj
+          "MOV     R0, #0\n"
+          "B       loc_FF961310\n"
+     ".ltorg\n"
+     );
+}
Index: /trunk/platform/s5is/sub/101a/stubs_dryos.S
===================================================================
--- /trunk/platform/s5is/sub/101a/stubs_dryos.S	(revision 511)
+++ /trunk/platform/s5is/sub/101a/stubs_dryos.S	(revision 511)
@@ -0,0 +1,2 @@
+
+
Index: /trunk/platform/s5is/sub/101a/stubs_entry_2.S
===================================================================
--- /trunk/platform/s5is/sub/101a/stubs_entry_2.S	(revision 511)
+++ /trunk/platform/s5is/sub/101a/stubs_entry_2.S	(revision 511)
@@ -0,0 +1,184 @@
+    #include "stubs_asm.h"
+
+NHSTUB(SleepTask                              ,0xFF82AC20)
+NHSTUB(CreateTask                             ,0xFF81B9C4)
+NHSTUB(ExitTask                               ,0xFF81BC54)
+NHSTUB(AllocateMemory                         ,0xFFA41170)
+
+// Look over all these again, some point to a B sub_.... so that's unnecessary.
+NHSTUB(ExecuteEventProcedure                  ,0xFF81BF64)
+NHSTUB(FreeMemory                             ,0xFFA4115C)
+NHSTUB(GetCurrentTargetDistance               ,0xFF95126C)
+NHSTUB(GetSystemTime                          ,0xFFA4126C)
+NHSTUB(ints_disable                           ,0xFF81058C) // Actually identified as IRQdisable by signatures
+NHSTUB(ints_enable                            ,0xFF8105B4) // Actually identified as IRQenable by signatures
+NHSTUB(memcmp                                 ,0xFF81E72C)
+NHSTUB(memcpy                                 ,0xFF8B32C8)
+NHSTUB(memset                                 ,0xFFA64C5C)
+NHSTUB(Close                                  ,0xFF825D8C)
+NHSTUB(Open                                   ,0xFF825D64)
+NHSTUB(Read                                   ,0xFF825E34)
+NHSTUB(Write                                  ,0xFF825E38)
+NHSTUB(Lseek                                  ,0xFF825F94)
+NHSTUB(strcmp                                 ,0xFF81E6C4)
+NHSTUB(strcpy                                 ,0xFF81E670)
+NHSTUB(strlen                                 ,0xFF81E708)
+NHSTUB(TakeSemaphore                          ,0xFF81B860)
+NHSTUB(vsprintf                               ,0xFF81E5F0)    // first sub called in FADBGPrintf
+NHSTUB(GetFocusLensSubjectDistance            ,0xFF95250C)    // returns 0. What's wrong?
+NHSTUB(GetZoomLensCurrentPoint                ,0xFF957D84)
+NHSTUB(GetZoomLensCurrentPosition             ,0xFF957D88)
+NHSTUB(RefreshPhysicalScreen                  ,0xFF8B2E58)
+NHSTUB(GetPropertyCase                        ,0xFF874864)    // PT_GetPropertyCaseString
+NHSTUB(SetPropertyCase                        ,0xFF874774)    // PT_SetPropertyCaseString
+NHSTUB(VbattGet                               ,0xFF8222CC)    
+NHSTUB(GetParameterData                       ,0xFF973028) // Guess but it seems correct. IDA incorrectly identified sub_FF972524 as GetParameterData
+NHSTUB(SetParameterData                       ,0xFF972F9C) // Idem, with different address though :)
+NHSTUB(IsStrobeChargeCompleted                ,0xFF8DB5FC)
+
+
+// these (open, write, close) are educated guesses but not 100% certain
+NHSTUB(open                                   ,0xFF81A030)
+NHSTUB(write                                  ,0xFF81A328)
+NHSTUB(close                                  ,0xFF81A0E0)
+NHSTUB(lseek                                  ,0xFF825ECC) // Lseek_0
+NHSTUB(read                                   ,0xFF81A2C8) // Read
+
+NHSTUB(Fopen_Fut                              ,0xFF825730)
+NHSTUB(Fwrite_Fut                             ,0xFF825870)
+NHSTUB(Fclose_Fut                             ,0xFF825770)
+NHSTUB(Fread_Fut                              ,0xFF82581C)
+NHSTUB(Fseek_Fut                              ,0xFF825910)
+
+NHSTUB(Remove                                 ,0xFF825DD4)
+NHSTUB(rename                                 ,0xFF825E60)
+
+NHSTUB(stat                                   ,0xFF825F98)
+NHSTUB(openfastdir                            ,0xFFA27934)
+NHSTUB(readfastdir                            ,0xFFA279C8)
+NHSTUB(closefastdir                           ,0xFFA27A98)
+
+NHSTUB(opendir                                ,0xFFA27934) // OpenFastDir
+NHSTUB(ReadFastDir                            ,0xFFA279C8)
+NHSTUB(closedir                               ,0xFFA27A98) // CloseFastDir
+NHSTUB(mkdir                                  ,0xFF826130)
+
+NHSTUB(GetDrive_ClusterSize                   ,0xFF856DD0)
+NHSTUB(GetDrive_TotalClusters                 ,0xFF856E04)
+NHSTUB(GetDrive_FreeClusters                  ,0xFF856E70)
+
+NHSTUB(LockMainPower                          ,0xFF877DF8)
+NHSTUB(UnlockMainPower                        ,0xFF877D54)
+
+NHSTUB(GetCurrentAvValue                      ,0xFF952E5C)
+NHSTUB(MoveFocusLensToDistance                ,0xFFA0D4E4)
+NHSTUB(MoveZoomLensWithPoint                  ,0xFF957BFC)
+NHSTUB(SetZoomActuatorSpeedPercent            ,0xFF957D38)
+
+NHSTUB(malloc                                 ,0xFF813A2C)
+NHSTUB(free                                   ,0xFF813B00)
+NHSTUB(FreeUncacheableMemory                  ,0xFF82ADD0)
+NHSTUB(AllocateUncacheableMemory              ,0xFF82AD9C)
+
+NHSTUB(rand                                   ,0xFF81E834)
+NHSTUB(srand                                  ,0xFF81BDB4)
+NHSTUB(_log10                                 ,0xFFA92F04)
+NHSTUB(_pow                                   ,0xFFA93074)
+NHSTUB(_log                                   ,0xFFA93FC0)
+NHSTUB(_sqrt                                  ,0xFFA95328)
+
+NHSTUB(qsort                                  ,0xFF9CA2EC)
+
+NHSTUB(strstr                                 ,0xFF9C9E0C)
+NHSTUB(strncpy                                ,0xFF81E688)
+NHSTUB(strrchr                                ,0xFF8B32A0)
+NHSTUB(strncmp                                ,0xFF8B3230)
+NHSTUB(strchr                                 ,0xFF8B327C)
+NHSTUB(strcat                                 ,0xFF8B31F4)
+NHSTUB(strtol                                 ,0xFF831DAC)
+
+NHSTUB(LocalTime                              ,0xFF8706CC)
+
+NHSTUB(UpdateMBROnFlash                       ,0xFF856B98)
+
+NHSTUB(UniqueLedOn                            ,0xFF913BBC)
+NHSTUB(UniqueLedOff                           ,0xFF913C44)
+
+NHSTUB(SetAutoShutdownTime                    ,0xFF877F58)
+
+
+NHSTUB(phySw                                  ,0xFF823668)
+NHSTUB(phySw_p1                               ,0xFF823A6C) // called from phySw
+NHSTUB(phySw_p2                               ,0xFF82330C) // called when phySw_p1 returns 1
+NHSTUB(NewTaskShell                           ,0xFF874330) // starts new shell on Console. GUI output?
+
+NHSTUB(kbd_read_keys                          ,0xFF823990) // Called in kbd.c (originally called from phySw_p1, line 3)
+NHSTUB(kbd_p1_f                               ,0xFF823A6C) // is phySw_p1
+NHSTUB(kbd_p1_f_cont                          ,0xFF823A78) // after call to kbd_read_keys
+NHSTUB(kbd_p2_f                               ,0xFF82330C) // is phySw_p2
+NHSTUB(kbd_read_keys_r2                       ,0xFF84D4AC) // called from kbd_read_keys
+
+
+
+// Possibly useful but not yet necessary
+NHSTUB(GetCCDTemperature                      ,0xFF8505BC) // Unknown units, doesn't really seem to respond
+NHSTUB(GetBatteryTemperature                  ,0xFF85062C) // Unknown units, doesn't really seem to respond to frozen batteries
+NHSTUB(GetOpticalTemperature                  ,0xFF85069C) // Unknown units, doesn't really seem to respond
+NHSTUB(OpenMShutter                           ,0xFFA0BED0)
+NHSTUB(CloseMShutter                          ,0xFFA0BE98)
+NHSTUB(PutOutNdFilter                         ,0xFFA0BE00) // Doesn't really work on S5, sometimes crashes camera
+NHSTUB(PutInNdFilter                          ,0xFFA0BDC8) // Doesn't really work on S5, sometimes crashes camera
+NHSTUB(SSAPI_ExtStrobeCharged                 ,0xFF8288B4) // Functionality unknown. Implied effect implemented in IsStrobeChargeCompleted
+
+
+
+///////////
+// FOLLOWING FUNCTION NOT FOUND, points to nullsub. Function does not exist
+// where it is to be expected according to A720 firmware. Copied it from A720
+// and hooked in boot.c
+//NHSTUB(time, 0xFF81096C)
+
+
+///////////
+// The following functions were not found in the S5 firmware. They do not
+// seem to be required but for some reason someone made this list.
+// Point to nullsub for immediate return
+// nullsub_1: 0xFF81096C (S5)
+NSTUB(CreatePhysicalVram,		 0xFF81096C)
+NSTUB(CreateTaskStrict,			 0xFF81096C)
+NSTUB(DisableDispatch,			 0xFF81096C)
+NSTUB(DisplayImagePhysicalScreen,	 0xFF81096C)
+NSTUB(EnableDispatch,			 0xFF81096C)
+NSTUB(ioctl,					 0xFF81096C)
+NSTUB(iosDevAdd,				 0xFF81096C)
+NSTUB(iosDrvInstall,			 0xFF81096C)
+NSTUB(isalpha,					 0xFF81096C)
+NSTUB(isdigit,					 0xFF81096C)
+NSTUB(islower,					 0xFF81096C)
+NSTUB(isspace,					 0xFF81096C)
+NSTUB(isupper,					 0xFF81096C)
+NSTUB(localtime,				 0xFF81096C)
+NSTUB(MakeDirectory,			 0xFF81096C)
+NSTUB(memPartAlloc,				 0xFF81096C)
+NSTUB(memPartFindMax,			 0xFF81096C)
+NSTUB(Mount_FileSystem,			 0xFF81096C)
+NSTUB(PhySw_testgpio,			 0xFF81096C)
+NSTUB(ProtectFile,				 0xFF81096C)
+NSTUB(readdir,					 0xFF81096C)
+NSTUB(rewinddir,				 0xFF81096C)
+NSTUB(taskCreateHookAdd,			 0xFF81096C)
+NSTUB(taskDeleteHookAdd,			 0xFF81096C)
+NSTUB(taskIdListGet,			 0xFF81096C)
+NSTUB(taskLock,				 0xFF81096C)
+NSTUB(taskName,				 0xFF81096C)
+NSTUB(taskResume,				 0xFF81096C)
+NSTUB(taskSuspend,				 0xFF81096C)
+NSTUB(taskUnlock,				 0xFF81096C)
+NSTUB(utime,					 0xFF81096C)
+NSTUB(Unmount_FileSystem,		 0xFF81096C)
+NSTUB(UIFS_WriteFirmInfoToFile,	 0xFF81096C)
+NSTUB(kbd_pwr_off,				 0xFF81096C) // Does not even exist, I think
+NSTUB(kbd_pwr_on,				 0xFF81096C) // Does not even exist, I think
+NHSTUB(PT_PlaySound, 0xFF86B5A4)
+NHSTUB(EnterToCompensationEVF, 0xff828070) 
+NHSTUB(ExitFromCompensationEVF, 0xff828164) 
Index: /trunk/platform/s5is/sub/101a/boot.c
===================================================================
--- /trunk/platform/s5is/sub/101a/boot.c	(revision 511)
+++ /trunk/platform/s5is/sub/101a/boot.c	(revision 511)
@@ -0,0 +1,1796 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+const long new_sa = MEMISOSTART + MEMISOSIZE;
+
+/* Our stuff */
+extern long wrs_kernel_bss_start;
+extern long wrs_kernel_bss_end;
+
+// Forward declarations
+void CreateTask_blinker();
+void CreateTask_PhySw();
+void CreateTask_spytask();
+
+void boot();
+void __attribute__((naked,noinline)) task_blinker();
+void dump_chdk();
+
+////////////////////////////////////////////////////////////////////////////////
+// Note to developers:
+// The code below is just somewhat annotated in an attempt to figure out what
+// the camera does. I left it in, it might be of some use to someone someday.
+// Occasionally, I added the .ltorg directive, because the compiler/assembler
+// isn't smart enough to place it somewhere sensible. Remember to bypass
+// (B new_location) that directive if you really *MUST* place it in the middle
+// of your code.
+////////////////////////////////////////////////////////////////////////////////
+
+
+#define DEBUG_LED 0xC02200D4 // Red led (lower-right corner) normally indicating SD read/write
+
+void boot() {
+    asm volatile ("B      sub_FF81000C_my\n");
+};
+
+
+void __attribute__((naked,noinline)) sub_FF81000C_my() {
+     asm volatile (
+          "LDR     R1, =0xC0400004\n"
+          "LDR     R2, [R1]\n"
+          "ORR     R2, R2, #2\n"
+          "STR     R2, [R1]\n"
+          "LDR     R1, =0xC0410000\n"
+          "MOV     R0, #0\n"
+          "STR     R0, [R1]\n"
+          "MOV     R1, #0x78\n"
+          "MCR     p15, 0, R1,c1,c0\n"
+          "MOV     R1, #0\n"
+          "MCR     p15, 0, R1,c7,c10, 4\n"
+          "MCR     p15, 0, R1,c7,c5\n"
+          "MCR     p15, 0, R1,c7,c6\n"
+          "MOV     R0, #0x3D\n"
+          "MCR     p15, 0, R0,c6,c0\n"
+          "MOV     R0, #0xC000002F\n"
+          "MCR     p15, 0, R0,c6,c1\n"
+          "MOV     R0, #0x33\n"
+          "MCR     p15, 0, R0,c6,c2\n"
+          "LDR     R0, =0x10000033\n"
+          "MCR     p15, 0, R0,c6,c3\n"
+          "MOV     R0, #0x40000017\n"
+          "MCR     p15, 0, R0,c6,c4\n"
+          "LDR     R0, =0xFF80002D\n"
+          "MCR     p15, 0, R0,c6,c5\n"
+          "MOV     R0, #0x34\n"
+          "MCR     p15, 0, R0,c2,c0\n"
+          "MOV     R0, #0x34\n"
+          "MCR     p15, 0, R0,c2,c0, 1\n"
+          "MOV     R0, #0x34\n"
+          "MCR     p15, 0, R0,c3,c0\n"
+          "LDR     R0, =0x3333330\n"
+          "MCR     p15, 0, R0,c5,c0, 2\n"
+          "LDR     R0, =0x3333330\n"
+          "MCR     p15, 0, R0,c5,c0, 3\n"
+          "MRC     p15, 0, R0,c1,c0\n"
+          "ORR     R0, R0, #0x1000\n"
+          "ORR     R0, R0, #4\n"
+          "ORR     R0, R0, #1\n"
+          "MCR     p15, 0, R0,c1,c0\n"
+          "MOV     R1, #0x40000006\n"
+          "MCR     p15, 0, R1,c9,c1\n"
+          "MOV     R1, #6\n"
+          "MCR     p15, 0, R1,c9,c1, 1\n"
+          "MRC     p15, 0, R1,c1,c0\n"
+          "ORR     R1, R1, #0x50000\n"
+          "MCR     p15, 0, R1,c1,c0\n"
+          "LDR     R2, =0xC0200000\n"
+          "MOV     R1, #1\n"
+          "STR     R1, [R2,#0x10C]\n"
+          "MOV     R1, #0xFF\n"
+          "STR     R1, [R2,#0xC]\n"
+          "STR     R1, [R2,#0x1C]\n"
+          "STR     R1, [R2,#0x2C]\n"
+          "STR     R1, [R2,#0x3C]\n"
+          "STR     R1, [R2,#0x4C]\n"
+          "STR     R1, [R2,#0x5C]\n"
+          "STR     R1, [R2,#0x6C]\n"
+          "STR     R1, [R2,#0x7C]\n"
+          "STR     R1, [R2,#0x8C]\n"
+          "STR     R1, [R2,#0x9C]\n"
+          "STR     R1, [R2,#0xAC]\n"
+          "STR     R1, [R2,#0xBC]\n"
+          "STR     R1, [R2,#0xCC]\n"
+          "STR     R1, [R2,#0xDC]\n"
+          "STR     R1, [R2,#0xEC]\n"
+          "STR     R1, [R2,#0xFC]\n"
+          "LDR     R1, =0xC0400008\n"
+          "LDR     R2, =0x430005\n"
+          "STR     R2, [R1]\n"
+          "MOV     R1, #1\n"
+          "LDR     R2, =0xC0243100\n"
+          "STR     R2, [R1]\n"
+          "LDR     R2, =0xC0242010\n"
+          "LDR     R1, [R2]\n"
+          "ORR     R1, R1, #1\n"
+          "STR     R1, [R2]\n"
+          "LDR     R0, =0xFFB07FA8\n"
+          "LDR     R1, =0x1900\n"
+          "LDR     R3, =0x1056C\n"
+
+     "loc_FF81014C:\n"
+          "CMP     R1, R3\n"                     // Copy code from 0xFFB07FA8(inc) onwards to 0x1900(inc) .. 0x1056C (ex)
+          "LDRCC   R2, [R0],#4\n"
+          "STRCC   R2, [R1],#4\n"
+          "BCC     loc_FF81014C\n"               // loop
+          "LDR     R1, =0x9B610\n"
+          "MOV     R2, #0\n"
+
+     "loc_FF810164:\n"
+          "CMP     R3, R1\n"                     // Zerofill from 0x1056C(inc) .. 0x9B610(exc)
+          "STRCC   R2, [R3],#4\n"
+          "BCC     loc_FF810164\n"               // loop
+//          "B       sub_FF8101B8\n"
+          "B       sub_FF8101B8_my\n"            // +---------------------> Hook
+     ".ltorg\n"
+     );
+}
+
+
+void __attribute__((naked,noinline)) sub_FF8101B8_my() {
+     asm volatile (
+     "loc_FF8101B8:\n"
+          "LDR     R0, =0xFF810230\n"
+          "MOV     R1, #0\n"
+          "LDR     R3, =0xFF810268\n"
+
+     "loc_FF8101C4:\n"
+          "CMP     R0, R3\n"                     // Copy code from 0xFF810230(inc) .. 0xFF810268(exc) to 0x0 .. 0x38
+          "LDRCC   R2, [R0],#4\n"
+          "STRCC   R2, [R1],#4\n"
+          "BCC     loc_FF8101C4\n"               // loop
+          "LDR     R0, =0xFF810268\n"
+          "MOV     R1, #0x4B0\n"
+          "LDR     R3, =0xFF81047C\n"
+
+     "loc_FF8101E0:\n"
+          "CMP     R0, R3\n"                     // Copy code from 0xFF810268(inc) .. 0xFF81047C(exc) to 0x4B0 .. 0x6C4
+          "LDRCC   R2, [R0],#4\n"
+          "STRCC   R2, [R1],#4\n"
+          "BCC     loc_FF8101E0\n"               // loop
+          "MOV     R0, #0xD2\n"
+          "MSR     CPSR_cxsf, R0\n"
+          "MOV     SP, #0x1000\n"
+          "MOV     R0, #0xD3\n"
+          "MSR     CPSR_cxsf, R0\n"
+          "MOV     SP, #0x1000\n"
+          "LDR     R0, =0x6C4\n"
+          "LDR     R2, =0xEEEEEEEE\n"
+          "MOV     R3, #0x1000\n"
+
+     "loc_FF810214:\n"
+          "CMP     R0, R3\n"                     // Fill 0x6C4 .. 0x1000 with 0xEEEEEEEE
+          "STRCC   R2, [R0],#4\n"
+          "BCC     loc_FF810214\n"               // loop
+//          "BL      sub_FF810FCC\n"
+          "BL      sub_FF810FCC_my\n"            // +---------------------> Hook
+     ".ltorg\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF810FCC_my() {
+     asm volatile (
+          "STR     LR, [SP,#-0x4]!\n"
+          "SUB     SP, SP, #0x74\n"
+          "MOV     R0, SP\n"
+          "MOV     R1, #0x74\n"
+          "BL      sub_FFA92D04\n"
+          "MOV     R0, #0x53000\n"
+          "STR     R0, [SP,#0x74-0x70]\n"
+//          "LDR     R0, =0x9B610\n"
+          );    
+//          "LDR     R0, =0xDB610\n"			// 0x9B610 + 0x40000 (memsize) = 0xDB610
+          asm volatile (
+              "LDR     R0, =new_sa\n"
+              "LDR     R0, [R0]\n"
+          );
+          asm volatile (
+          "LDR     R2, =0x2ABC00\n"
+          "LDR     R1, =0x2A4968\n"
+          "STR     R0, [SP,#0x74-0x6C]\n"
+          "SUB     R0, R1, R0\n"
+          "ADD     R3, SP, #0x74-0x68\n"
+          "STR     R2, [SP,#0x74-0x74]\n"
+          "STMIA   R3, {R0-R2}\n"
+          "MOV     R0, #0x22\n"
+          "STR     R0, [SP,#0x74-0x5C]\n"
+          "MOV     R0, #0x68\n"
+          "STR     R0, [SP,#0x74-0x58]\n"
+          "LDR     R0, =0x19B\n"
+          "MOV     R1, #0x64\n"
+//          "STRD    R0, [SP,#0x74-0x54]\n"  // WORKSFORME, configure gcc WITHOUT --with-cpu=arm9
+          "STR    R0, [SP,#0x74-0x54]\n"     // Though use the old, 2-line version
+          "STR    R1, [SP,#0x74-0x50]\n"     // for the final until everyone uses 'new' gcc
+          "MOV     R0, #0x78\n"
+//          "STRD    R0, [SP,#0x74-0x4C]\n"  // Idem
+          "STR    R0, [SP,#0x74-0x4C]\n"     // Idem
+          "STR    R1, [SP,#0x74-0x48]\n"     // Idem
+          "MOV     R0, #0\n"
+          "STR     R0, [SP,#0x74-0x44]\n"
+          "STR     R0, [SP,#0x74-0x40]\n"
+          "MOV     R0, #0x10\n"
+          "STR     R0, [SP,#0x74-0x18]\n"
+          "MOV     R0, #0x800\n"
+          "STR     R0, [SP,#0x74-0x14]\n"
+          "MOV     R0, #0xA0\n"
+          "STR     R0, [SP,#0x74-0x10]\n"
+          "MOV     R0, #0x280\n"
+          "STR     R0, [SP,#0x74-0xC]\n"
+//          "LDR     R1, =sub_FF814E0C\n"
+          "LDR     R1, =sub_FF814E0C_my\n"       // +---------------------> Hook
+          "MOV     R0, SP\n"
+          "MOV     R2, #0\n"
+          "BL      sub_FF812D84\n"
+          "ADD     SP, SP, #0x74\n"
+          "LDR     PC, [SP],#4\n"
+     ".ltorg\n"
+     );
+}
+
+
+void __attribute__((naked,noinline)) sub_FF814E0C_my() {
+        asm volatile (
+              "STMFD   SP!, {R4,LR}\n"
+              "BL      sub_FF810970\n"
+              "BL      sub_FF819898\n"           // dmSetup
+              "CMP     R0, #0\n"
+//              "ADRLT   R0, aDmsetup\n"
+              "LDRLT   R0, =0xFF814F20\n"
+              "BLLT    sub_FF814F00\n"           // err_init_task
+              "BL      sub_FF814A30\n"           // termDriverInit
+              "CMP     R0, #0\n"
+//              "ADRLT   R0, aTermdriverinit\n" 
+              "LDRLT   R0, =0xFF814F28\n"
+              "BLLT    sub_FF814F00\n"           // err_init_task
+//              "ADR     R0, a_term\n"
+              "LDR     R0, =0xFF814F38\n"
+              "BL      sub_FF814B1C\n"           // termDeviceCreate
+              "CMP     R0, #0\n"
+//              "ADRLT   R0, aTermdevicecrea\n"
+              "LDRLT   R0, =0xFF814F40\n"
+              "BLLT    sub_FF814F00\n"           // err_init_task
+//              "ADR     R0, a_term\n"
+              "LDR     R0, =0xFF814F38\n"
+              "BL      sub_FF813594\n"           // stdioSetup
+              "CMP     R0, #0\n"
+//              "ADRLT   R0, aStdiosetup\n"
+              "LDRLT   R0, =0xFF814F54\n"
+              "BLLT    sub_FF814F00\n"           // err_init_task
+              "BL      sub_FF819580\n"           // stdlibSetup
+              "CMP     R0, #0\n"
+//              "ADRLT   R0, aStdlibsetup\n"
+              "LDRLT   R0, =0xFF814F60\n"
+              "BLLT    sub_FF814F00\n"           // err_init_task
+              "BL      sub_FF8114E4\n"           // armlib_setup
+              "CMP     R0, #0\n"
+//              "ADRLT   R0, aArmlib_setup\n"
+              "LDRLT   R0, =0xFF814F6C\n"
+              "BLLT    sub_FF814F00\n"           // err_init_task
+              "LDMFD   SP!, {R4,LR}\n"
+              //"B       sub_FF81DAB8\n"         // CreateTaskStartup
+              "B       sub_FF81DAB8_my\n"        // +---------------------> Hook
+     ".ltorg\n"
+        );
+};
+
+
+void __attribute__((naked,noinline)) sub_FF81DAB8_my() {
+     asm volatile (
+          "STMFD   SP!, {R3,LR}\n"
+          "BL      sub_FF82CEF0\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF81DAF4\n"
+          "BL      sub_FF824DCC\n"
+          "CMP     R0, #0\n"
+          "LDREQ   R2, =0xC0220000\n"
+          "LDREQ   R0, [R2,#0x10C]\n"
+          "LDREQ   R1, [R2,#0x108]\n"
+          "ORREQ   R0, R0, R1\n"
+          "TSTEQ   R0, #1\n"
+          "BNE     loc_FF81DAF4\n"
+          "MOV     R0, #0x44\n"
+          "STR     R0, [R2,#0x4C]\n"
+
+     "loc_FF81DAF0:\n"
+          "B       loc_FF81DAF0\n"
+
+
+     "loc_FF81DAF4:\n"
+          "BL      sub_FF8236F8\n"
+          "BL      sub_FF82AA98\n"
+          "MOV     R1, #0x300000\n"
+          "MOV     R0, #0\n"
+          "BL      sub_FF82ACE0\n"
+          "BL      sub_FF82AC8C\n"
+          "MOV     R3, #0\n"
+          "STR     R3, [SP,#8-8]\n"
+//          "LDR     R3, sub_FF81DA18\n"         // Startup, 0xFF81DA18
+          "LDR     R3, =sub_FF81DA18_my\n"       // +---------------------> Hook
+          "MOV     R2, #0\n"
+          "MOV     R1, #0x19\n"
+//          "ADR     R0, aStartup\n"
+          "LDR     R0, =0xFF81DB44\n"
+          "BL      sub_FF81B9C4\n"               // CreateTask
+          "MOV     R0, #0\n"
+          "LDMFD   SP!, {R12,PC}\n"
+     ".ltorg\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF81DA18_my() {
+     asm volatile (
+          "STMFD   SP!, {R4,LR}\n"
+          "BL      sub_FF81521C\n"
+          "BL      sub_FF824840\n"
+          "BL      sub_FF820E14\n"
+          //"BL      j_nullsub_163\n"            
+          "BL      sub_FF82D0E0\n"
+//          "BL      sub_FF82CFC8\n"            // Apparently responsible for
+                                                // diskboot. Bypassing it does
+                                                // not seem to affect the camera
+                                                // negatively.
+     );
+     
+     CreateTask_spytask();
+     
+     asm volatile (
+          "LDR     R4, =0x66A8\n"
+          "B       loc_FF81DA44\n"
+
+     "loc_FF81DA3C:\n"
+          "SUBS    R4, R4, #1\n"
+          "BEQ     loc_FF81DA54\n"
+
+     "loc_FF81DA44:\n"
+          "MOV     R0, #5\n"
+          "BL      sub_FF820F1C\n"
+          "CMP     R0, #1\n"
+          "BEQ     loc_FF81DA3C\n"
+
+     "loc_FF81DA54:\n"
+          "MOV     R0, #5\n"
+          "BL      sub_FF821314\n"
+          "SUBS    R12, R0, #0x300\n"
+          "SUBGES  R12, R12, #0xF6\n"
+          "BLE     loc_FF81DA78\n"
+          "BL      sub_FF829FD4\n"
+          "MOV     R1, #0xB5\n"
+//          "ADR     R0, aStartup_c\n"
+          "LDR     R0, =0xFF81DB34\n"
+          "BL      sub_FF81BD94\n"               // Assert, 0xFF81BD94
+
+     "loc_FF81DA78:\n"
+          "BL      sub_FF82DB84\n"
+          "BL      sub_FF82D130\n"
+          "BL      sub_FF829FD4\n"
+          "BL      sub_FF82DB94\n"
+          //"BL      sub_FF82369C\n"             // PhySw, bypass and create own
+     );
+
+     CreateTask_PhySw();
+
+     asm volatile (
+//          "BL      sub_FF826A50\n"             // CaptSeqTask and lots of other stuff
+          "BL      sub_FF826A50_my\n"            // +---------------------> Hook (in capt_seq.c)
+          "BL      sub_FF82DBB4\n"
+          //"BL      nullsub_2\n"
+          "BL      sub_FF822A60\n"
+          "BL      sub_FF82CCBC\n"
+          "BL      sub_FF823188\n"
+          "BL      sub_FF82296C\n"
+          //"BL      sub_FF82E638\n"
+          "BL      sub_FF82E638_my\n"            // +---> MAJOR HOOK (SDHC boot)
+          "BL      sub_FF8227F0\n"
+          "LDMFD   SP!, {R4,LR}\n"
+          "B       sub_FF8150D8\n"
+     ".ltorg\n"
+     );
+}
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+// Major SDHC boot fix hook starts here
+//
+// Paths that certainly do not (by itself) get the SDHC booting going:
+// sub_FF82E638 -> sub_FF824DE0 -> sub_FF824B28 -> sub_FF87C040 (entire 'right subtree')
+// sub_FF82E638 -> sub_FF82E1E8 -> sub_FF87AD50 -> sub_FF87A408 -> sub_FF87C040 (shortest path (subroutine-count-wise) through 'left subtree')
+// sub_FF82E638 -> sub_FF82E1E8 -> sub_FF87AD50 -> sub_FF87A8D4 -> sub_FF87A408 -> sub_FF87C040 (sub_FF87A8D4 does not appear to be called)
+// 
+// Unexplored:
+// sub_FF82E638 -> sub_FF82E1E8 -> sub_FF87BE10 -> sub_FF87BC5C -> sub_FF87AD50 ->              -> sub_FF87A408 -> sub_FF87C040
+//                                                                              -> sub_FF87A8D4 ->
+//
+// Final, working path:
+// sub_FF82E638 -> sub_FF82E1E8 -> sub_FF87BE10 -> sub_FF87BC5C -> sub_FF87AD50 -> sub_FF87A408 -> sub_FF87C040
+//
+// That's the 'tree'-part, the rest of the subroutines are just straight on down, no junctions.
+// -> sub_FF87BFF0 -> sub_FF8750A4 -> sub_FF8569D8 -> sub_FF856814 -> sub_FF8566AC
+/////////////////////////////////////////////////////////////////////////////////////
+
+void __attribute__((naked,noinline)) sub_FF82E638_my() {
+     asm volatile (
+          "STMFD   SP!, {R4,LR}\n"
+          "BL      sub_FF878E50\n"
+          "BL      sub_FF824DA0\n"
+          "CMP     R0, #1\n"
+          "BNE     loc_FF82E658\n"
+          "BL      sub_FF87C154\n"
+          "LDMFD   SP!, {R4,LR}\n"
+          "B       sub_FF824DE0\n"
+
+     "loc_FF82E658:\n"
+          "BL      sub_FF87AFF8\n"
+          "LDR     R4, =0x1E80\n"
+          "LDR     R0, [R4,#4]\n"
+          "CMP     R0, #0\n"
+          "LDMNEFD SP!, {R4,PC}\n"
+          "MOV     R1, #0\n"
+          //"LDR     R0, =0xFF82E1E8\n"
+          "LDR     R0, =sub_FF82E1E8_my\n"       // +----> Hook for SDHC booting
+          "BL      sub_FF875A00\n"
+          "STR     R0, [R4,#4]\n"
+          "LDMFD   SP!, {R4,PC}\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF82E1E8_my() {
+     asm volatile (
+          "STMFD   SP!, {R3-R11,LR}\n"
+          "LDR     R6, =0x1E80\n"
+          "MOV     R5, R1\n"
+          "LDR     R0, [R6,#0x14]\n"
+          "MOV     R4, R3\n"
+          "CMP     R0, #1\n"
+          "BNE     loc_FF82E20C\n"
+          "BL      sub_FF8796A8\n"
+          "B       loc_FF82E290\n"
+
+     "loc_FF82E20C:\n"
+          "LDR     R12, =0x1162\n"
+          "LDR     R10, =0x1005\n"
+          "CMP     R5, R12\n"
+          "MOV     R7, #0\n"
+          "MOV     R8, #1\n"
+          "BEQ     loc_FF82E58C\n"
+          "BGT     loc_FF82E354\n"
+          "LDR     R12, =0x1062\n"
+          "CMP     R5, R12\n"
+          "BEQ     loc_FF82E614\n"
+          "BGT     loc_FF82E2C0\n"
+          "CMP     R5, R10\n"
+          "BEQ     loc_FF82E310\n"
+          "BGT     loc_FF82E298\n"
+          "SUB     R12, R5, #0x800\n"
+          "SUBS    R12, R12, #3\n"
+          "BEQ     loc_FF82E494\n"
+          "SUB     R12, R5, #0x800\n"
+          "SUBS    R12, R12, #0x158\n"
+          "BEQ     loc_FF82E61C\n"
+          "LDR     R4, =0x9A3\n"
+          "CMP     R5, R4\n"
+          "ADD     R7, R4, #2\n"
+          "CMPNE   R5, R7\n"
+          "BNE     loc_FF82E57C\n"
+          "LDR     R0, [R6,#0xC]\n"
+          "SUB     R12, R0, #0x8000\n"
+          "SUBS    R12, R12, #2\n"
+          "BEQ     loc_FF82E290\n"
+          "LDR     R0, =0x10A5\n"
+          "BL      sub_FF877B44\n"
+          "CMP     R0, #0\n"
+          "BEQ     loc_FF82E568\n"
+
+     "loc_FF82E290:\n"
+          "MOV     R0, #0\n"
+          "LDMFD   SP!, {R3-R11,PC}\n"
+
+     "loc_FF82E298:\n"
+          "SUB     R12, R5, #0x1000\n"
+          "SUBS    R12, R12, #0x56\n"
+          "SUBNE   R12, R5, #0x1000\n"
+          "SUBNES  R12, R12, #0x5B\n"
+          "SUBNE   R12, R5, #0x1000\n"
+          "SUBNES  R12, R12, #0x5E\n"
+          "SUBNE   R12, R5, #0x1000\n"
+          "SUBNES  R12, R12, #0x61\n"
+          "BNE     loc_FF82E57C\n"
+          "B       loc_FF82E614\n"
+
+     "loc_FF82E2C0:\n"
+          "LDR     R12, =0x10AD\n"
+          "CMP     R5, R12\n"
+          "BEQ     loc_FF82E5B4\n"
+          "BGT     loc_FF82E318\n"
+          "SUB     R12, R5, #0x1000\n"
+          "SUBS    R12, R12, #0x63\n"
+          "SUBNE   R12, R5, #0x1000\n"
+          "SUBNES  R12, R12, #0x65\n"
+          "BEQ     loc_FF82E614\n"
+          "SUB     R12, R5, #0x1000\n"
+          "LDR     R0, =0x10A3\n"
+          "SUBS    R12, R12, #0xA9\n"
+          "BEQ     loc_FF82E5A8\n"
+          "SUB     R12, R5, #0x1000\n"
+          "SUBS    R12, R12, #0xAA\n"
+          "BNE     loc_FF82E57C\n"
+          "BL      sub_FF877B44\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF82E290\n"
+
+     "loc_FF82E30C:\n"
+          "BL      sub_FF82EBCC\n"
+
+     "loc_FF82E310:\n"
+          "MOV     R1, R4\n"
+          "B       loc_FF82E580\n"
+
+     "loc_FF82E318:\n"
+          "SUB     R12, R5, #0x1000\n"
+          "SUBS    R12, R12, #0xAE\n"
+          "BEQ     loc_FF82E30C\n"
+          "SUB     R12, R5, #0x1000\n"
+          "SUBS    R12, R12, #0xAF\n"
+          "BEQ     loc_FF82E5B4\n"
+          "SUB     R12, R5, #0x1000\n"
+          "SUBS    R12, R12, #0xB0\n"
+          "BEQ     loc_FF82E30C\n"
+          "SUB     R12, R5, #0x1000\n"
+          "SUBS    R12, R12, #0xB2\n"
+          "BNE     loc_FF82E57C\n"
+          "LDR     R0, =0x1008\n"
+          "MOV     R1, R4\n"
+          "B       loc_FF82E584\n"
+
+     "loc_FF82E354:\n"
+          "LDR     R11, =0x201B\n"
+          "LDR     R0, =0x1E80\n"
+          "CMP     R5, R11\n"
+          "LDR     R2, [R0,#0x10]!\n"
+          "LDR     R1, [R0,#0x10]\n"
+          "SUB     R9, R11, #0x17\n"
+          "BEQ     loc_FF82E548\n"
+          "BGT     loc_FF82E41C\n"
+          "LDR     R11, =0x116A\n"
+          "CMP     R5, R11\n"
+          "BEQ     loc_FF82E534\n"
+          "BGT     loc_FF82E3D0\n"
+          "SUB     R12, R5, #0x1100\n"
+          "SUBS    R12, R12, #0x63\n"
+          "MOVEQ   R1, #0\n"
+          "MOVEQ   R0, #0x82\n"
+          "BEQ     loc_FF82E560\n"
+          "SUB     R12, R5, #0x1100\n"
+          "SUBS    R12, R12, #0x65\n"
+          "BEQ     loc_FF82E558\n"
+          "LDR     R4, =0x1168\n"
+          "SUB     R12, R5, #0x1100\n"
+          "SUBS    R12, R12, #0x67\n"
+          "CMPNE   R5, R4\n"
+          "BNE     loc_FF82E57C\n"
+          "STR     R8, [R6,#0x10]\n"
+          "LDR     R6, =0x4508\n"
+          "CMP     R1, #0\n"
+          "BEQ     loc_FF82E524\n"
+          "BL      sub_FF8796DC\n"
+          "B       loc_FF82E528\n"
+
+     "loc_FF82E3D0:\n"
+          "SUB     R12, R5, #0x2000\n"
+          "SUBS    R12, R12, #2\n"
+          "BEQ     loc_FF82E5E0\n"
+          "CMP     R5, R9\n"
+          "MOV     R0, R9\n"
+          "BEQ     loc_FF82E5EC\n"
+          "SUB     R12, R5, #0x2000\n"
+          "SUBS    R12, R12, #5\n"
+          "BEQ     loc_FF82E5E0\n"
+          "SUB     R12, R5, #0x2000\n"
+          "SUBS    R12, R12, #0x19\n"
+          "BNE     loc_FF82E57C\n"
+          "CMP     R1, #0\n"
+          "BEQ     loc_FF82E290\n"
+          "CMP     R2, #0\n"
+          "BNE     loc_FF82E290\n"
+
+     "loc_FF82E410:\n"
+          "MOV     R1, #0\n"
+
+     "loc_FF82E414:\n"
+          "BL      sub_FF87AD50\n"
+          "B       loc_FF82E290\n"
+
+     "loc_FF82E41C:\n"
+          "LDR     R12, =0x3110\n"
+          "CMP     R5, R12\n"
+          "BEQ     loc_FF82E310\n"
+          "BGT     loc_FF82E464\n"
+          "SUB     R12, R5, #0x2000\n"
+          "SUBS    R12, R12, #0x1D\n"
+          "BEQ     loc_FF82E5E0\n"
+          "LDR     R0, =0x2027\n"
+          "CMP     R5, R0\n"
+          "BEQ     loc_FF82E5C0\n"
+          "SUB     R12, R5, #0x3000\n"
+          "SUBS    R12, R12, #6\n"
+          "BEQ     loc_FF82E310\n"
+          "SUB     R12, R5, #0x3000\n"
+          "SUBS    R12, R12, #0x10\n"
+          "BNE     loc_FF82E57C\n"
+          "BL      sub_FF89A6F0\n"
+          "B       loc_FF82E290\n"
+
+     "loc_FF82E464:\n"
+          "SUB     R12, R5, #0x3100\n"
+          "SUBS    R12, R12, #0x11\n"
+          "BEQ     loc_FF82E310\n"
+          "CMP     R5, #0x3140\n"
+          "BEQ     loc_FF82E608\n"
+          "SUB     R12, R5, #0x3200\n"
+          "SUBS    R12, R12, #1\n"
+          "BEQ     loc_FF82E57C\n"
+          "SUB     R12, R5, #0x3200\n"
+          "SUBS    R12, R12, #2\n"
+          "BEQ     loc_FF82E310\n"
+          "B       loc_FF82E57C\n"
+
+     "loc_FF82E494:\n"
+          "MOV     R4, #1\n"
+          "MOV     R0, #2\n"
+          "BL      sub_FF878EE4\n"
+          "CMP     R0, #1\n"
+          "MOVEQ   R4, #2\n"
+          "MOV     R0, R4\n"
+          "BL      sub_FF822D8C\n"
+          "CMP     R0, #0\n"
+          "STRNE   R8, [R6,#0x14]\n"
+          "BNE     loc_FF82E4F0\n"
+          "BL      sub_FF87F8DC\n"
+          "BL      sub_FF87CE00\n"
+          "BL      sub_FF87DCA0\n"
+          "BL      sub_FF87E1B0\n"
+          "BL      sub_FF87C3D8\n"
+          "BL      sub_FF87E5AC\n"
+          "CMP     R0, #0\n"
+          "BEQ     loc_FF82E4F8\n"
+          "BL      sub_FF82DF54\n"
+          "BL      sub_FF87E5A0\n"
+          "MOV     R1, R0\n"
+          "LDR     R0, =0x1167\n"
+          "BL      sub_FF8761C8\n"
+
+     "loc_FF82E4F0:\n"
+          "MOV     R0, R7\n"
+          "LDMFD   SP!, {R3-R11,PC}\n"
+
+     "loc_FF82E4F8:\n"
+          "BL      sub_FF827068\n"
+          "CMP     R0, #1\n"
+          "LDRNE   R0, =0x310B\n"
+          "LDREQ   R0, =0x310C\n"
+          "MOV     R1, #0\n"
+          "BL      sub_FF8761C8\n"
+          //"BL      sub_FF87BE10\n"
+          "BL      sub_FF87BE10_my\n"            // +----> Hook for SDHC booting
+          "B       loc_FF82E4F0\n"
+
+     "loc_FF82E518:\n"
+          "MOV     R0, R6\n"
+          "BL      sub_FF864270\n"
+          "B       loc_FF82E290\n"
+
+     "loc_FF82E524:\n"
+          "BL      sub_FF826D60\n"
+
+     "loc_FF82E528:\n"
+          "CMP     R5, R4\n"
+          "BNE     loc_FF82E290\n"
+          "B       loc_FF82E518\n"
+
+     "loc_FF82E534:\n"
+          "MOV     R0, #1\n"
+          "BL      sub_FF8797F4\n"
+          "MOV     R1, R11\n"
+          "MOV     R0, R10\n"
+          "B       loc_FF82E584\n"
+
+     "loc_FF82E548:\n"
+          "CMP     R2, #1\n"
+          "BNE     loc_FF82E310\n"
+          "BL      sub_FF8796DC\n"
+          "B       loc_FF82E290\n"
+
+     "loc_FF82E558:\n"
+          "MOV     R1, #0\n"
+          "MOV     R0, #0x83\n"
+
+     "loc_FF82E560:\n"
+          "BL      sub_FF87E284\n"
+          "B       loc_FF82E290\n"
+
+     "loc_FF82E568:\n"
+          "CMP     R5, R4\n"
+          "STREQ   R8, [R6,#0x34]\n"
+          "BEQ     loc_FF82E57C\n"
+          "CMP     R5, R7\n"
+          "STREQ   R8, [R6,#0x30]\n"
+
+     "loc_FF82E57C:\n"
+          "MOV     R1, #0\n"
+
+     "loc_FF82E580:\n"
+          "MOV     R0, R5\n"
+
+     "loc_FF82E584:\n"
+          "BL      sub_FF87AD50\n"
+          "LDMFD   SP!, {R3-R11,PC}\n"
+
+     "loc_FF82E58C:\n"
+          "BL      sub_FF882328\n"
+          "CMP     R0, #0\n"
+          "BEQ     loc_FF82E310\n"
+          "BL      sub_FF882C38\n"
+          "CMP     R0, #0\n"
+          "BLEQ    sub_FF88105C\n"
+          "B       loc_FF82E310\n"
+
+     "loc_FF82E5A8:\n"
+          "BL      sub_FF877B44\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF82E290\n"
+
+     "loc_FF82E5B4:\n"
+          "MOV     R0, R5\n"
+          "BL      sub_FF82E074\n"
+          "LDMFD   SP!, {R3-R11,PC}\n"
+
+     "loc_FF82E5C0:\n"
+          "MOV     R1, #0\n"
+          "BL      sub_FF87AD50\n"
+          "MOV     R1, #0\n"
+          "MOV     R0, R11\n"
+          "BL      sub_FF87AD50\n"
+          "MOV     R1, #0\n"
+          "MOV     R0, R9\n"
+          "B       loc_FF82E414\n"
+
+     "loc_FF82E5E0:\n"
+          "STR     R7, [R6,#0x20]\n"
+          "BL      sub_FF82E86C\n"
+          "B       loc_FF82E310\n"
+
+     "loc_FF82E5EC:\n"
+          "STR     R7, [R6,#0x20]\n"
+          "BL      sub_FF82E86C\n"
+          "LDR     R0, [R6,#0x10]\n"
+          "CMP     R0, #1\n"
+          "BNE     loc_FF82E310\n"
+          "BL      sub_FF879708\n"
+          "B       loc_FF82E290\n"
+
+     "loc_FF82E608:\n"
+          "CMP     R1, #0\n"
+          "BLEQ    sub_FF82E86C\n"
+          "B       loc_FF82E290\n"
+
+     "loc_FF82E614:\n"
+          "MVN     R0, #0\n"
+          "B       loc_FF82E410\n"
+
+     "loc_FF82E61C:\n"
+          "TST     R4, #0x80000000\n"
+          "MOVNE   R0, #1\n"
+          "LDMNEFD SP!, {R3-R11,PC}\n"
+          "BL      sub_FF883DD0\n"
+          "CMP     R0, #0\n"
+          "BLEQ    sub_FF829DA0\n"
+          "B       loc_FF82E290\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF87BE10_my() {
+     asm volatile (
+          "STMFD   SP!, {R4,LR}\n"
+          "BL      sub_FF82E838\n"
+          "MOV     R4, R0\n"
+          "BL      sub_FF87BF2C\n"
+          "MOV     R0, R4\n"
+          "BL      sub_FF87BCC0\n"
+          "BL      sub_FF82E838\n"
+          "MOV     R4, R0\n"
+          "LDR     R0, =0x6374\n"
+          "LDR     R0, [R0]\n"
+          "TST     R0, #1\n"
+          "BEQ     loc_FF87BE4C\n"
+
+     "loc_FF87BE40:\n"
+          "MOV     R1, R4\n"
+          "MOV     R0, #2\n"
+          "B       loc_FF87BEB4\n"
+
+     "loc_FF87BE4C:\n"
+          "TST     R0, #0x2000\n"
+          "BEQ     loc_FF87BE68\n"
+          "TST     R0, #0x200\n"
+          "LDREQ   R1, =0x4004\n"
+          "LDRNE   R1, =0x8002\n"
+          "MOV     R0, #3\n"
+          "B       loc_FF87BEB4\n"
+
+     "loc_FF87BE68:\n"
+          "TST     R0, #0x10\n"
+          "BNE     loc_FF87BE40\n"
+          "TST     R0, #0x40\n"
+          "BEQ     loc_FF87BE84\n"
+
+     "loc_FF87BE78:\n"
+          "MOV     R1, R4\n"
+          "MOV     R0, #1\n"
+          "B       loc_FF87BEB4\n"
+
+     "loc_FF87BE84:\n"
+          "TST     R0, #0x20\n"
+          "BEQ     loc_FF87BEA0\n"
+          "TST     R0, #0x4000\n"
+          "BNE     loc_FF87BEA0\n"
+
+     "loc_FF87BE94:\n"
+          "MOV     R1, R4\n"
+          "MOV     R0, #0\n"
+          "B       loc_FF87BEB4\n"
+
+     "loc_FF87BEA0:\n"
+          "LDR     R1, =0x102\n"
+          "BICS    R1, R1, R0\n"
+          "BNE     loc_FF87BEBC\n"
+          "MOV     R1, R4\n"
+          "MOV     R0, #6\n"
+
+     "loc_FF87BEB4:\n"
+          "LDMFD   SP!, {R4,LR}\n"
+          //"B       sub_FF87BC5C\n"
+          "B       sub_FF87BC5C_my\n"            // +----> Hook for SDHC booting
+
+     "loc_FF87BEBC:\n"
+          "TST     R0, #0x100\n"
+          "BNE     loc_FF87BE40\n"
+          "TST     R0, #0x4000\n"
+          "TSTEQ   R0, #0x400\n"
+          "BNE     loc_FF87BE78\n"
+          "TST     R0, #0x200\n"
+          "TSTEQ   R0, #2\n"
+          "BNE     loc_FF87BE94\n"
+          "TST     R0, #0x40000\n"
+          "BEQ     loc_FF87BE40\n"
+          "TST     R0, #0x200000\n"
+          "MOVEQ   R1, R4\n"
+          "MOVEQ   R0, #1\n"
+          //"BLEQ    sub_FF87BC5C\n"
+          "BLEQ    sub_FF87BC5C_my\n"            // +----> Hook for SDHC booting
+          "B       loc_FF87BE40\n"
+     );
+}
+
+
+void __attribute__((naked,noinline)) sub_FF87BC5C_my() {
+     asm volatile (
+          "STMFD   SP!, {R4-R6,LR}\n"
+          "MOVS    R4, R0\n"
+          "MOV     R0, #1\n"
+          "MOV     R5, R1\n"
+          "BNE     loc_FF87BC9C\n"
+          "MOV     R1, #0\n"
+          "MOV     R0, #0\n"
+          "BL      sub_FF878E74\n"
+          "BL      sub_FF82E838\n"
+          "SUB     R12, R0, #0x1000\n"
+          "SUBS    R12, R12, #0x5B\n"
+          "BNE     loc_FF87BC94\n"
+
+     "loc_FF87BC8C:\n"
+          "BL      sub_FF87BBA4\n"
+          "B       loc_FF87BCA4\n"
+
+     "loc_FF87BC94:\n"
+          "BL      sub_FF87BBE4\n"
+          "B       loc_FF87BCA4\n"
+
+     "loc_FF87BC9C:\n"
+          "CMP     R4, #5\n"
+          "BEQ     loc_FF87BC8C\n"
+
+     "loc_FF87BCA4:\n"
+          "CMP     R0, #0\n"
+          "LDREQ   R5, =0x1162\n"
+          "MOVEQ   R4, #2\n"
+          "MOV     R0, R4\n"
+          "MOV     R1, R5\n"
+          "LDMFD   SP!, {R4-R6,LR}\n"
+          //"B       sub_FF87AD50\n"
+          "B       sub_FF87AD50_my\n"            // +----> Hook for SDHC booting
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF87AD50_my() {
+     asm volatile (
+          "STMFD   SP!, {R4-R8,LR}\n"
+          "MOV     R8, R1\n"
+          "MOV     R4, R0\n"
+          "BL      sub_FF8799F0\n"
+          "LDR     R5, =0x62AC\n"
+          "MOV     R7, #1\n"
+          "LDR     R0, [R5,#0x10]\n"
+          "MOV     R6, #0\n"
+          "CMP     R0, #0x15\n"
+          "ADDLS   PC, PC, R0,LSL#2\n"
+          "B       loc_FF87AFF0\n"
+
+     "loc_FF87AD7C:\n"
+          "B       loc_FF87ADD4\n"
+
+     "loc_FF87AD80:\n"
+          "B       loc_FF87ADFC\n"
+
+     "loc_FF87AD84:\n"
+          "B       loc_FF87AE40\n"
+
+     "loc_FF87AD88:\n"
+          "B       loc_FF87AEB4\n"
+
+     "loc_FF87AD8C:\n"
+          "B       loc_FF87AEC4\n"
+
+     "loc_FF87AD90:\n"
+          "B       loc_FF87AED0\n"
+
+     "loc_FF87AD94:\n"
+          "B       loc_FF87AF40\n"
+
+     "loc_FF87AD98:\n"
+          "B       loc_FF87AF50\n"
+
+     "loc_FF87AD9C:\n"
+          "B       loc_FF87ADE4\n"
+
+     "loc_FF87ADA0:\n"
+          "B       loc_FF87ADF0\n"
+
+     "loc_FF87ADA4:\n"
+          "B       loc_FF87AF50\n"
+
+     "loc_FF87ADA8:\n"
+          "B       loc_FF87AE34\n"
+
+     "loc_FF87ADAC:\n"
+          "B       loc_FF87AFF0\n"
+
+     "loc_FF87ADB0:\n"
+          "B       loc_FF87AFF0\n"
+
+     "loc_FF87ADB4:\n"
+          "B       loc_FF87AE4C\n"
+
+     "loc_FF87ADB8:\n"
+          "B       loc_FF87AE58\n"
+
+     "loc_FF87ADBC:\n"
+          "B       loc_FF87AE8C\n"
+
+     "loc_FF87ADC0:\n"
+          "B       loc_FF87AE08\n"
+
+     "loc_FF87ADC4:\n"
+          "B       loc_FF87AFD8\n"
+
+     "loc_FF87ADC8:\n"
+          "B       loc_FF87AF5C\n"
+
+     "loc_FF87ADCC:\n"
+          "B       loc_FF87AF8C\n"
+
+     "loc_FF87ADD0:\n"
+          "B       loc_FF87AF8C\n"
+
+     "loc_FF87ADD4:\n"
+          "MOV     R1, R8\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          //"B       sub_FF87A408\n"
+          "B       sub_FF87A408_my\n"            // +----> Hook for SDHC booting
+
+     "loc_FF87ADE4:\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          "B       sub_FF87B720\n"
+
+     "loc_FF87ADF0:\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          "B       sub_FF87A8D4\n"
+
+     "loc_FF87ADFC:\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          "B       sub_FF879FD0\n"
+
+     "loc_FF87AE08:\n"
+          "SUB     R12, R4, #0x1000\n"
+          "SUBS    R12, R12, #0xA5\n"
+          "STREQ   R7, [R5,#0x84]\n"
+          "BEQ     loc_FF87AFE8\n"
+          "SUB     R12, R4, #0x3000\n"
+          "SUBS    R12, R12, #6\n"
+          "BNE     loc_FF87AFF0\n"
+          "MOV     R0, #0\n"
+          "BL      sub_FF82DDAC\n"
+          "BL      sub_FF87B644\n"
+          "B       loc_FF87AFE8\n"
+
+     "loc_FF87AE34:\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          "B       sub_FF87B680\n"
+
+     "loc_FF87AE40:\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          "B       sub_FF87A1CC\n"
+
+     "loc_FF87AE4C:\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          "B       sub_FF87AA80\n"
+
+     "loc_FF87AE58:\n"
+          "SUB     R12, R4, #0x3200\n"
+          "SUBS    R12, R12, #2\n"
+          "BNE     loc_FF87AFF0\n"
+          "MOV     R0, #3\n"
+          "BL      sub_FF8798D4\n"
+          "MOV     R0, #8\n"
+          "BL      sub_FF82DD18\n"
+          "MOV     R0, #6\n"
+          "BL      sub_FF842464\n"
+          "BL      sub_FF87D210\n"
+          "BL      sub_FF87D06C\n"
+          "BL      sub_FF87C448\n"
+          "B       loc_FF87AFE8\n"
+
+     "loc_FF87AE8C:\n"
+          "SUB     R12, R4, #0x3300\n"
+          "SUBS    R12, R12, #1\n"
+          "BNE     loc_FF87AFF0\n"
+          "LDR     R0, =0x4010\n"
+          "BL      sub_FF82DD18\n"
+          "BL      sub_FF89F050\n"
+          "BL      sub_FF87C448\n"
+          "MOV     R0, #4\n"
+          "BL      sub_FF8798D4\n"
+          "B       loc_FF87AFE8\n"
+
+     "loc_FF87AEB4:\n"
+          "MOV     R1, R8\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          "B       sub_FF87ABE8\n"
+
+     "loc_FF87AEC4:\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          "B       sub_FF87B850\n"
+
+     "loc_FF87AED0:\n"
+          "LDR     R8, =0x1182\n"
+          "CMP     R4, R8\n"
+          "STREQ   R7, [R5,#0xB0]\n"
+          "BEQ     loc_FF87AFE8\n"
+          "SUB     R12, R4, #0x1100\n"
+          "SUBS    R12, R12, #0x86\n"
+          "BEQ     loc_FF87AF28\n"
+          "SUB     R12, R4, #0x3200\n"
+          "SUBS    R12, R12, #0x16\n"
+          "BNE     loc_FF87AFF0\n"
+          "MOV     R0, #8\n"
+          "BL      sub_FF82DD18\n"
+          "MOV     R0, #3\n"
+          "BL      sub_FF8798D4\n"
+          "STR     R6, [R5,#0xB4]\n"
+          "LDR     R0, [R5,#0xB0]\n"
+          "CMP     R0, #0\n"
+          "MOVNE   R1, #0\n"
+          "MOVNE   R0, R8\n"
+          "STRNE   R6, [R5,#0xB0]\n"
+          "BLNE    sub_FF87ABE8\n"
+          "B       loc_FF87AFE8\n"
+
+     "loc_FF87AF28:\n"
+          "LDR     R0, [R5,#0xB4]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF87AFE8\n"
+          "BL      sub_FF89C720\n"
+          "STR     R7, [R5,#0xB4]\n"
+          "B       loc_FF87AFE8\n"
+
+     "loc_FF87AF40:\n"
+          "MOV     R1, R8\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          "B       sub_FF87B930\n"
+
+     "loc_FF87AF50:\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          "B       sub_FF87A7CC\n"
+
+     "loc_FF87AF5C:\n"
+          "LDR     R12, =0x10B0\n"
+          "CMP     R4, R12\n"
+          "BEQ     loc_FF87AF88\n"
+          "BGT     loc_FF87AF94\n"
+          "CMP     R4, #4\n"
+          "BEQ     loc_FF87AFBC\n"
+          "SUB     R12, R4, #0x1000\n"
+          "SUBS    R12, R12, #0xAA\n"
+          "SUBNE   R12, R4, #0x1000\n"
+          "SUBNES  R12, R12, #0xAE\n"
+          "BNE     loc_FF87AFF0\n"
+
+     "loc_FF87AF88:\n"
+          "BL      sub_FF8795D0\n"
+
+     "loc_FF87AF8C:\n"
+          "MOV     R0, R6\n"
+          "LDMFD   SP!, {R4-R8,PC}\n"
+
+     "loc_FF87AF94:\n"
+          "SUB     R12, R4, #0x2000\n"
+          "SUBS    R12, R12, #4\n"
+          "BEQ     loc_FF87AFD0\n"
+          "SUB     R12, R4, #0x5000\n"
+          "SUBS    R12, R12, #1\n"
+          "SUBNE   R12, R4, #0x5000\n"
+          "SUBNES  R12, R12, #6\n"
+          "BNE     loc_FF87AFF0\n"
+          "BL      sub_FF879F70\n"
+          "B       loc_FF87AFE8\n"
+
+     "loc_FF87AFBC:\n"
+          "LDR     R0, [R5,#0x2C]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF87AFD0\n"
+          "BL      sub_FF826D18\n"
+          "B       loc_FF87AFE8\n"
+
+     "loc_FF87AFD0:\n"
+          "BL      sub_FF879608\n"
+          "B       loc_FF87AFE8\n"
+
+     "loc_FF87AFD8:\n"
+          "SUB     R12, R4, #0x3000\n"
+          "SUBS    R12, R12, #0x130\n"
+          "BNE     loc_FF87AFF0\n"
+          "BL      sub_FF8796A8\n"
+
+     "loc_FF87AFE8:\n"
+          "MOV     R0, #0\n"
+          "LDMFD   SP!, {R4-R8,PC}\n"
+
+     "loc_FF87AFF0:\n"
+          "MOV     R0, #1\n"
+          "LDMFD   SP!, {R4-R8,PC}\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF87A408_my() {
+     asm volatile (
+          "STMFD   SP!, {R4-R8,LR}\n"
+          "LDR     R7, =0x8002\n"
+          "LDR     R4, =0x62AC\n"
+          "CMP     R0, #3\n"
+          "MOV     R6, R1\n"
+          "MOV     R5, #1\n"
+          "BEQ     loc_FF87A57C\n"
+          "BGT     loc_FF87A444\n"
+          "CMP     R0, #0\n"
+          "BEQ     loc_FF87A488\n"
+          "CMP     R0, #1\n"
+          "BEQ     loc_FF87A50C\n"
+          "CMP     R0, #2\n"
+          "BNE     loc_FF87A604\n"
+          "B       loc_FF87A45C\n"
+
+     "loc_FF87A444:\n"
+          "CMP     R0, #6\n"
+          "STREQ   R5, [R4,#0x28]\n"
+          "BEQ     loc_FF87A574\n"
+          "SUB     R12, R0, #0x2000\n"
+          "SUBS    R12, R12, #4\n"
+          "BNE     loc_FF87A604\n"
+
+     "loc_FF87A45C:\n"
+          "SUB     R12, R6, #0x1100\n"
+          "SUBS    R12, R12, #0x62\n"
+          "BNE     loc_FF87A478\n"
+          "MOV     R1, R7\n"
+          "MOV     R0, #0\n"
+          "BL      sub_FF87E284\n"
+          "STR     R5, [R4,#0x60]\n"
+
+     "loc_FF87A478:\n"
+          "BL      sub_FF87D210\n"
+          "BL      sub_FF87D06C\n"
+          "BL      sub_FF879F10\n"
+          "B       loc_FF87A5FC\n"
+
+     "loc_FF87A488:\n"
+          "MOV     R0, #7\n"
+          "BL      sub_FF8798D4\n"
+          "MOV     R0, R7\n"
+          "BL      sub_FF82DD18\n"
+          "BL      sub_FF87C07C\n"
+          "BL      sub_FF87CEE4\n"
+          "MOV     R1, R7\n"
+          "MOV     R0, #0\n"
+          "BL      sub_FF87E284\n"
+          //"ADR     R1, aAcBootrec\n"             // \"AC:BootRec\"
+          "LDR     R1, =0xFF87A63C\n"             // \"AC:BootRec\"
+          "MOV     R0, #0x20\n"
+          "STR     R6, [R4,#0x18]\n"
+          "BL      sub_FF872B20\n"
+          //"ADR     R1, aAcInitlens\n"            // \"AC:InitLens\"
+          "LDR     R1, =0xFF87A648\n"            // \"AC:InitLens\"
+          "MOV     R0, #0x20\n"
+          "BL      sub_FF872B20\n"
+          "STR     R5, [R4,#0x28]\n"
+          "BL      sub_FF82DEC0\n"
+          "BL      sub_FF82DE04\n"
+          "LDR     R0, [R4,#0x1C]\n"
+          "LDR     R1, [R4,#0x20]\n"
+          "ORRS    R0, R0, R1\n"
+          "BLNE    sub_FF87B1AC\n"
+          "LDR     R0, [R4,#0x68]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF87A4F8\n"
+          "BL      sub_FF82DF30\n"
+          "B       loc_FF87A500\n"
+
+     "loc_FF87A4F8:\n"
+          "BL      sub_FF826AB0\n"
+          "BL      sub_FF82E7C8\n"
+
+     "loc_FF87A500:\n"
+          //"BL      sub_FF87C040\n"
+          "BL      sub_FF87C040_my\n"            // +----> Hook for SDHC booting
+          "BL      sub_FF87C0B8\n"
+          "B       loc_FF87A5FC\n"
+
+     "loc_FF87A50C:\n"
+          "MOV     R0, #8\n"
+          "BL      sub_FF8798D4\n"
+          "BL      sub_FF87C07C\n"
+          "BL      sub_FF87CEE4\n"
+          "LDR     R5, =0x4004\n"
+          "MOV     R0, #0\n"
+          "MOV     R1, R5\n"
+          "BL      sub_FF87E284\n"
+          //"ADR     R1, aAcBootpb\n"              // \"AC:BootPB\"
+          "LDR     R1, =0xFF87A658\n"              // \"AC:BootPB\"
+          "MOV     R0, #0x20\n"
+          "BL      sub_FF872B20\n"
+          //"BL      sub_FF87C040\n"
+          "BL      sub_FF87C040_my\n"            // +----> Hook for SDHC booting
+          "BL      sub_FF87C154\n"
+          "BL      sub_FF82E758\n"
+          "MOV     R0, R5\n"
+          "BL      sub_FF82DD18\n"
+          "LDR     R0, [R4,#0x68]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF87A560\n"
+          "BL      sub_FF82DF30\n"
+          "B       loc_FF87A564\n"
+
+     "loc_FF87A560:\n"
+          "BL      sub_FF826AB0\n"
+
+     "loc_FF87A564:\n"
+          "BL      sub_FF87C0E8\n"
+          "LDR     R0, [R4,#0x30]\n"
+          "CMP     R0, #0\n"
+          "BEQ     loc_FF87A5FC\n"
+
+     "loc_FF87A574:\n"
+          "BL      sub_FF87B1D0\n"
+          "B       loc_FF87A5FC\n"
+
+     "loc_FF87A57C:\n"
+          "MOV     R1, R6\n"
+          "MOV     R0, #0\n"
+          "BL      sub_FF87E284\n"
+          //"ADR     R1, aAcBootclock\n"           // \"AC:BootClock\"
+          "LDR     R1, =0xFF87A664\n"           // \"AC:BootClock\"
+          "MOV     R0, #0x20\n"
+          "BL      sub_FF872B20\n"
+          "STR     R5, [R4,#0x68]\n"
+          "BL      sub_FF87C154\n"
+          "BL      sub_FF82E758\n"
+          "BL      sub_FF87B17C\n"
+          "BL      sub_FF82E82C\n"
+          "CMP     R0, #0\n"
+          "LDRNE   R0, =0x8045\n"
+          "MOVNE   R1, #0\n"
+          "BLNE    sub_FF878A9C\n"
+          "BL      sub_FF87E098\n"
+          "MOV     R0, #0x80\n"
+          "BL      sub_FF82DD18\n"
+          "BL      sub_FF87D3A0\n"
+          "BL      sub_FF8B0F7C\n"
+          "BL      sub_FF9732E0\n"
+          "BL      sub_FF8AF7D0\n"
+          "BL      sub_FF87CAAC\n"
+          "BL      sub_FF87D248\n"
+          "MOV     R0, #9\n"
+          "BL      sub_FF8798D4\n"
+          "LDR     R0, =0x300E\n"
+          "MOV     R1, R6\n"
+          "BL      sub_FF8761C8\n"
+          "MOV     R1, #0\n"
+          "MOV     R0, #1\n"
+          "BL      sub_FF87E284\n"
+
+     "loc_FF87A5FC:\n"
+          "MOV     R0, #0\n"
+          "LDMFD   SP!, {R4-R8,PC}\n"
+
+     "loc_FF87A604:\n"
+          "MOV     R0, #1\n"
+          "LDMFD   SP!, {R4-R8,PC}\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF87C040_my() {
+     asm volatile (
+
+          "LDR     R0, =0x6380\n"
+          "STMFD   SP!, {R3,LR}\n"
+          "LDR     R1, [R0,#0x10]\n"
+          "CMP     R1, #1\n"
+          "BEQ     locret_FF87BFB0\n"
+          "MOV     R1, #1\n"
+          "STR     R1, [R0,#0x10]\n"
+          "MOV     R3, #0\n"
+          "STR     R3, [SP,#8-8]\n"
+          //"LDR     R3, =sub_FF87BFF0\n"
+          "LDR     R3, =sub_FF87BFF0_my\n"       // +----> Hook for SDHC booting
+          "MOV     R1, #0x19\n"
+          //"LDR     R0, =aInitfilemodule\n"        // \"InitFileModules\"
+          "LDR     R0, =0xFF87C1C0\n"
+          "MOV     R2, #0x1000\n"
+          "BL      sub_FF81B9C4\n"
+
+     "locret_FF87BFB0:\n"
+          "LDMFD   SP!, {R12,PC}\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF87BFF0_my() {
+     asm volatile (
+          "STMFD   SP!, {R4-R6,LR}\n"
+          "BL      sub_FF875078\n"
+          "LDR     R5, =0x5006\n"
+          "MOVS    R4, R0\n"
+          "MOVNE   R1, #0\n"
+          "MOVNE   R0, R5\n"
+          "BLNE    sub_FF8761C8\n"
+          //"BL      sub_FF8750A4\n"
+          "BL      sub_FF8750A4_my\n"            // +----> Hook for SDHC booting
+
+          "BL      core_spytask_can_start\n"     // +----> CHDK: Set "it's-safe-to-start"-Flag for spytask
+
+          "CMP     R4, #0\n"
+          "MOVEQ   R0, R5\n"
+          "LDMEQFD SP!, {R4-R6,LR}\n"
+          "MOVEQ   R1, #0\n"
+          "BEQ     sub_FF8761C8\n"
+          "LDMFD   SP!, {R4-R6,PC}\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF8750A4_my() {
+     asm volatile (
+          "STMFD   SP!, {R4,LR}\n"
+          //"BL      sub_FF8569D8\n"
+          "BL      sub_FF8569D8_my\n"            // +----> Hook for SDHC booting
+          "LDR     R4, =0x5C88\n"
+          "LDR     R0, [R4,#4]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF8750D4\n"
+          "BL      sub_FF888240\n"
+          "BL      sub_FF9275B4\n"
+          "BL      sub_FF888240\n"
+          "BL      sub_FF933D88\n"
+          "BL      sub_FF888250\n"
+          "BL      sub_FF92765C\n"
+
+     "loc_FF8750D4:\n"
+          "MOV     R0, #1\n"
+          "STR     R0, [R4]\n"
+          "LDMFD   SP!, {R4,PC}\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF8569D8_my() {
+     asm volatile (
+          "STMFD   SP!, {R4-R6,LR}\n"
+          "MOV     R6, #0\n"
+          "MOV     R0, R6\n"
+          "BL      sub_FF8565A8\n"
+          "LDR     R4, =0x131E4\n"
+          "MOV     R5, #0\n"
+          "LDR     R0, [R4,#0x38]\n"
+          "BL      sub_FF856F70\n"
+          "CMP     R0, #0\n"
+          "LDREQ   R0, =0x2EB4\n"
+          "STREQ   R5, [R0,#0xC]\n"
+          "STREQ   R5, [R0,#0x10]\n"
+          "STREQ   R5, [R0,#0x14]\n"
+          "MOV     R0, R6\n"
+          "BL      sub_FF8565E8\n"
+          "MOV     R0, R6\n"
+          //"BL      sub_FF856814\n"
+          "BL      sub_FF856814_my\n"            // +----> Hook for SDHC booting
+          "MOV     R5, R0\n"
+          "MOV     R0, R6\n"
+          "BL      sub_FF856880\n" 
+          "LDR     R1, [R4,#0x3C]\n"
+          "AND     R2, R5, R0\n"
+          "CMP     R1, #0\n"
+          "MOV     R0, #0\n"
+          "MOVEQ   R0, #0x80000001\n"
+          "BEQ     loc_FF856A6C\n"
+          "LDR     R3, [R4,#0x2C]\n"
+          "CMP     R3, #2\n"
+          "MOVEQ   R0, #4\n"
+          "CMP     R1, #5\n"
+          "ORRNE   R0, R0, #1\n"
+          "BICEQ   R0, R0, #1\n"
+          "CMP     R2, #0\n"
+          "BICEQ   R0, R0, #2\n"
+          "ORREQ   R0, R0, #0x80000000\n"
+          "BICNE   R0, R0, #0x80000000\n"
+          "ORRNE   R0, R0, #2\n"
+
+     "loc_FF856A6C:\n"
+          "STR     R0, [R4,#0x40]\n"
+          "LDMFD   SP!, {R4-R6,PC}\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF856814_my() {
+     asm volatile (
+          "STMFD   SP!, {R4-R6,LR}\n"
+          "LDR     R5, =0x2EB4\n"
+          "MOV     R6, R0\n"
+          "LDR     R0, [R5,#0x10]\n"
+          "CMP     R0, #0\n"
+          "MOVNE   R0, #1\n"
+          "LDMNEFD SP!, {R4-R6,PC}\n"
+          "MOV     R0, #0x17\n"
+          "MUL     R1, R0, R6\n"
+          "LDR     R0, =0x131E4\n"
+          "ADD     R4, R0, R1,LSL#2\n"
+          "LDR     R0, [R4,#0x38]\n"
+          "MOV     R1, R6\n"
+          //"BL      sub_FF8566AC\n"
+          "BL      sub_FF8566AC_my\n"            // +----> Hook for SDHC booting
+          "CMP     R0, #0\n"
+          "LDMEQFD SP!, {R4-R6,PC}\n"
+          "LDR     R0, [R4,#0x38]\n"
+          "MOV     R1, R6\n"
+          "BL      sub_FF857088\n"
+          "CMP     R0, #0\n"
+          "LDMEQFD SP!, {R4-R6,PC}\n"
+          "MOV     R0, R6\n"
+          "BL      sub_FF8561C8\n"
+          "CMP     R0, #0\n"
+          "MOVNE   R1, #1\n"
+          "STRNE   R1, [R5,#0x10]\n"
+          "LDMFD   SP!, {R4-R6,PC}\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF8566AC_my() {
+     asm volatile (
+          "STMFD   SP!, {R4-R8,LR}\n"
+          "MOV     R8, R0\n"
+          "MOV     R0, #0x17\n"
+          "MUL     R1, R0, R1\n"
+          "LDR     R0, =0x131E4\n"
+          "MOV     R6, #0\n"
+          "ADD     R7, R0, R1,LSL#2\n"
+          "LDR     R0, [R7,#0x3C]\n"
+          "MOV     R5, #0\n"
+          "CMP     R0, #6\n"
+          "ADDLS   PC, PC, R0,LSL#2\n"
+          "B       loc_FF8567F8\n"
+
+     "loc_FF8566DC:\n"
+          "B       loc_FF856710\n"
+
+     "loc_FF8566E0:\n"
+          "B       loc_FF8566F8\n"
+
+     "loc_FF8566E4:\n"
+          "B       loc_FF8566F8\n"
+
+     "loc_FF8566E8:\n"
+          "B       loc_FF8566F8\n"
+
+     "loc_FF8566EC:\n"
+          "B       loc_FF8566F8\n"
+
+     "loc_FF8566F0:\n"
+          "B       loc_FF8567F0\n"
+
+     "loc_FF8566F4:\n"
+          "B       loc_FF8566F8\n"
+
+     "loc_FF8566F8:\n"
+          "MOV     R2, #0\n"
+          "MOV     R1, #0x200\n"
+          "MOV     R0, #3\n"
+          "BL      sub_FF87178C\n"
+          "MOVS    R4, R0\n"
+          "BNE     loc_FF856718\n"
+
+     "loc_FF856710:\n"
+          "MOV     R0, #0\n"
+          "LDMFD   SP!, {R4-R8,PC}\n"
+
+     "loc_FF856718:\n"
+          "LDR     R12, [R7,#0x4C]\n"
+          "MOV     R3, R4\n"
+          "MOV     R2, #1\n"
+          "MOV     R1, #0\n"
+          "MOV     R0, R8\n"
+          //"BLX     R12\n"      // WORKSFORME, configure gcc WITHOUT --with-cpu=arm9
+          "MOV     LR, PC\n"     // 2-op workaround for 'normal' compiler
+          "MOV     PC, R12\n"    // Does the same thing, effectively, because PC is always 8 bytes ahead.
+          "CMP     R0, #1\n"
+          "BNE     loc_FF856744\n"
+          "MOV     R0, #3\n"
+          "BL      sub_FF87160C\n"
+          "B       loc_FF856710\n"
+
+///////
+// Offsets are fixed from here on, everything +0x10 for the second entry
+///////
+
+     "loc_FF856744:\n"
+          "MOV     R0, R8\n"
+          "BL      sub_FF9445D4\n"
+
+          // Start of DataGhost's FAT32 autodetection code
+          // Policy: If there is a partition which has type W95 FAT32, use the first one of those for image storage
+          // According to the code below, we can use R1, R2, R3 and R12.
+          // LR wasn't really used anywhere but for storing a part of the partition signature. This is the only thing
+          // that won't work with an offset, but since we can load from LR+offset into LR, we can use this to do that :)
+          "MOV     R12, R4\n"                    // Copy the MBR start address so we have something to work with
+          "MOV     LR, R4\n"                     // Save old offset for MBR signature
+          "MOV     R1, #1\n"                     // Note the current partition number
+          "B       dg_sd_fat32_enter\n"          // We actually need to check the first partition as well, no increments yet!
+     "dg_sd_fat32:\n"
+          "CMP     R1, #4\n"                     // Did we already see the 4th partition?
+          "BEQ     dg_sd_fat32_end\n"            // Yes, break. We didn't find anything, so don't change anything.
+          "ADD     R12, R12, #0x10\n"            // Second partition
+          "ADD     R1, R1, #1\n"                 // Second partition for the loop
+     "dg_sd_fat32_enter:\n"
+          "LDRB    R2, [R12, #0x1BE]\n"          // Partition status
+          "LDRB    R3, [R12, #0x1C2]\n"          // Partition type (FAT32 = 0xB)
+          "CMP     R3, #0xB\n"                   // Is this a FAT32 partition?
+          "CMPNE   R3, #0xC\n"                   // Not 0xB, is it 0xC (FAT32 LBA) then?
+          "BNE     dg_sd_fat32\n"                // No, it isn't. Loop again.
+          "CMP     R2, #0x00\n"                  // It is, check the validity of the partition type
+          "CMPNE   R2, #0x80\n"
+          "BNE     dg_sd_fat32\n"                // Invalid, go to next partition
+                                                 // This partition is valid, it's the first one, bingo!
+          "MOV     R4, R12\n"                    // Move the new MBR offset for the partition detection.
+          
+     "dg_sd_fat32_end:\n"
+          // End of DataGhost's FAT32 autodetection code
+
+          "LDRB    R1, [R4,#0x1C9]\n"            // 4th byte of LBA
+          "LDRB    R3, [R4,#0x1C8]\n"            // 3rd byte of LBA
+          "LDRB    R12, [R4,#0x1CC]\n"           // 3rd byte of partition length
+          "MOV     R1, R1,LSL#24\n"              // Shift and...
+          "ORR     R1, R1, R3,LSL#16\n"          // combine LBA bytes (endianness fix)
+          "LDRB    R3, [R4,#0x1C7]\n"            // 2nd byte of LBA
+          "LDRB    R2, [R4,#0x1BE]\n"            // Partition status (0x00=nonboot, 0x80=boot, other=bad)
+//          "LDRB    LR, [R4,#0x1FF]\n"            // Last MBR signature byte (0xAA)
+          "ORR     R1, R1, R3,LSL#8\n"           // Combine more LBA bytes
+          "LDRB    R3, [R4,#0x1C6]\n"            // 1st byte of LBA
+          "CMP     R2, #0\n"                     // Check partition status
+          "CMPNE   R2, #0x80\n"                  // and again
+          "ORR     R1, R1, R3\n"                 // Combine LBA into final value
+          "LDRB    R3, [R4,#0x1CD]\n"            // 4th byte of partition length
+          "MOV     R3, R3,LSL#24\n"              // Shift and...
+          "ORR     R3, R3, R12,LSL#16\n"         // combine partition length bytes
+          "LDRB    R12, [R4,#0x1CB]\n"           // 2nd byte of partition length
+          "ORR     R3, R3, R12,LSL#8\n"          // Combine partition length bytes
+          "LDRB    R12, [R4,#0x1CA]\n"           // 1st byte of partition length
+          "ORR     R3, R3, R12\n"                // Combine partition length bytes into final value
+//          "LDRB    R12, [R4,#0x1FE]\n"           // First MBR signature byte (0x55)
+          "LDRB    R12, [LR,#0x1FE]\n"           // + First MBR signature byte (0x55), LR is original offset.
+          "LDRB    LR, [LR,#0x1FF]\n"            // + Last MBR signature byte (0xAA), LR is original offset.
+          "MOV     R4, #0\n"                     // This value previously held a pointer to the partition table :(
+          "BNE     loc_FF8567CC\n"               // Jump out if the partition is malformed (partition status \'other\')
+          "CMP     R0, R1\n"
+          "BCC     loc_FF8567CC\n"               // Jump out if R0 < R1 (probably checking for a valid LBA addr)
+          "ADD     R2, R1, R3\n"                 // R2 = partition start address + length = partition end address
+          "CMP     R2, R0\n"                     // Guess: CMPLS is used to check for an overflow, the partition end address cannot be negative.
+          "CMPLS   R12, #0x55\n"                 // Check MBR signature with original offset
+          "CMPEQ   LR, #0xAA\n"                  // Check MBR signature with original offset
+          "MOVEQ   R6, R1\n"
+          "MOVEQ   R5, R3\n"
+          "MOVEQ   R4, #1\n"
+
+     "loc_FF8567CC:\n"
+          "MOV     R0, #3\n"
+          "BL      sub_FF87160C\n"
+          "CMP     R4, #0\n"
+          "BNE     loc_FF856804\n"
+          "MOV     R6, #0\n"
+          "MOV     R0, R8\n"
+          "BL      sub_FF9445D4\n"
+          "MOV     R5, R0\n"
+          "B       loc_FF856804\n"
+
+     "loc_FF8567F0:\n"
+          "MOV     R5, #0x40\n"
+          "B       loc_FF856804\n"
+
+     "loc_FF8567F8:\n"
+          "LDR     R1, =0x365\n"
+          //"ADR     R0, aMounter_c\n"             // \"Mounter.c\"
+          "LDR     R0, =0xFF8566A0\n"
+          //"BL      Assert\n"
+          "BL      sub_FF81BD94\n"
+
+     "loc_FF856804:\n"
+          "STR     R6, [R7,#0x44]!\n"
+          "MOV     R0, #1\n"
+          "STR     R5, [R7,#4]\n"
+          "LDMFD   SP!, {R4-R8,PC}\n"
+     );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// SDHC HOOK ENDS HERE
+////////////////////////////////////////////////////////////////////////////////
+
+
+// I could not manually find this function in the S5IS firmware, possibly signatures
+// might find it. Until that moment, I hooked it here (copied from another camera)
+unsigned long __attribute__((naked,noinline)) _time(unsigned long *timer) {
+     asm volatile (
+          "STMFD   SP!, {R3-R5,LR}\n"
+          "MOV     R4, R0\n"
+          "MVN     R0, #0\n"
+          "STR     R0, [SP,#0x10-0x10]\n"
+          "MOV     R0, SP\n"
+          "BL      sub_FF870C80\n" // _GetTimeOfSystem\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FFC55F38\n"
+          "CMP     R4, #0\n"
+          "LDRNE   R0, [SP,#0x10-0x10]\n"
+          "STRNE   R0, [R4]\n"
+
+     "loc_FFC55F38:\n"
+          "LDR     R0, [SP,#0x10-0x10]\n"
+          "LDMFD   SP!, {R3-R5,PC}\n"
+     );
+}
+
+
+
+void CreateTask_blinker() {
+        _CreateTask("Blinker", 0x1, 0x200, task_blinker, 0);
+};
+
+
+void __attribute__((naked,noinline)) task_blinker() {
+        int ledstate;
+
+        int counter = 0;
+
+        long *led = (void*) 0xC02200E0;   // AF led
+
+        long *anypointer;       // multi-purpose pointer to poke around in memory
+        long v1, v2, v3, v4;    // multi-purpose vars
+
+        ledstate = 0;   // init: led off
+        *led = 0x46;      // led on
+
+        while (1) {
+                counter++;
+
+                if (ledstate == 1) {    // toggle LED
+                        ledstate = 0;
+                        *led = 0x44;      // LED off
+                        //core_test(1);
+                } else {
+                        ledstate = 1;
+                        *led = 0x46;      // LED on
+                        //core_test(0);
+                }
+
+                if (counter == 2) {
+                        //dump_chdk();
+                        //gui_init();
+                        //_ExecuteEventProcedure("UIFS_WriteFirmInfoToFile");
+                        //_UIFS_WriteFirmInfoToFile(0);
+                }
+
+                if (counter == 10) {
+                        //draw_txt_string(2, 2, "test");
+                }
+
+                msleep(500);
+        }
+};
+
+
+void CreateTask_spytask() {
+        _CreateTask("SpyTask", 0x19, 0x2000, core_spytask, 0);
+};
+
+
+void CreateTask_PhySw() {
+        _CreateTask("PhySw", 0x17, 0x800, mykbd_task, 0);
+};
+
+
+//extern long _Fopen_Fut(const char *filename, const char *mode);
+//extern void _Fclose_Fut(long file);
+//extern long _Fwrite_Fut(const void *buf, long elsize, long count, long f);
+//extern long Fread_Fut(void *buf, long elsize, long count, long f);
+//extern long Fseek_Fut(long file, long offset, long whence);
+//extern long _qDump(char* filename, long unused, long write_p2, long write_p3);
+void dump_chdk() { //#fs
+    int fd;
+    long dirnum;
+        
+    volatile long *led = (void*) 0xC02200D0;   // yellow led
+
+    *led = 0x46; //on 
+
+  //  _qDump("A/qdump", 0, (void*) 0x01900, 0xb0000);
+    //_qDump("A/firmdump", 0, (void*) 0xFFC00000, 0x00400000);
+    //_qDump("A/firmlower", 0, (void*) 0xff800000, 0x00400000); // identical to 0xfc000000
+
+    //started();
+
+	//dirnum = get_target_dir_num();
+	//sprintf(fn, FN_RAWDIR, dirnum);
+	//mkdir(fn);
+
+	//sprintf(fn, FN_RAWDIR "/" "DMP_%04d.JPG", dirnum, ++ramdump_num);
+
+	//fd = _Fopen_Fut("A/dump", "w");
+	//if (fd >= 0) {
+	    //write(fd, (void*)0, 0x1900);
+	    //write(fd, (void*)0x1900, 32*1024*1024-0x1900);
+            //_Fwrite_Fut((void*)0x9D000, 0x20000, 0x20000, fd);
+	    //_Fclose_Fut(fd);
+	//}
+    *led = 0x44; //off
+    //finished();
+} //#fe
Index: /trunk/platform/s5is/sub/101a/stubs_min.S
===================================================================
--- /trunk/platform/s5is/sub/101a/stubs_min.S	(revision 511)
+++ /trunk/platform/s5is/sub/101a/stubs_min.S	(revision 511)
@@ -0,0 +1,24 @@
+#include "stubs_asm.h"
+
+// Documentation stripped, please refer to the S5IS 1.01b stubs_min.S if you
+// need it, or wait until someone feels like updating the documentation for this
+// particular model.
+
+DEF(physw_status, 0x11ABC)
+
+DEF(physw_run, 0x1CD8)
+
+DEF(led_table, 0x2710) // 0x270C + 4
+
+DEF(FlashParamsTable,0xFFAF0088) // ++ Only difference between 1.01a and 1.01b?
+
+DEF(zoom_busy, 0xB3B0)  //0xB37C + 0x34
+
+DEF(focus_busy, 0xB27C) //0xB274 + 8
+
+DEF(canon_menu_active,0x6E3C) // 0x63E8 + 4
+
+DEF(canon_shoot_menu_active,0xC05D) // 0xC05C + 1
+
+DEF(recreview_hold, 0xBE2C) // 0xBD60 + 0xCC
+
Index: /trunk/platform/s5is/sub/101a/makefile.inc
===================================================================
--- /trunk/platform/s5is/sub/101a/makefile.inc	(revision 511)
+++ /trunk/platform/s5is/sub/101a/makefile.inc	(revision 511)
@@ -0,0 +1,15 @@
+# USB ID: 04a9:3148
+PLATFORMID=12616
+
+PLATFORMOS=dryos
+
+MEMBASEADDR=0x1900
+RESTARTSTART=0x50000
+MEMISOSTART=0x9B610
+MEMISOSIZE=0x55000
+ROMBASEADDR=0xff810000
+
+TARGET_PRIMARY=$(topdir)platform/$(PLATFORM)/sub/$(PLATFORMSUB)/PRIMARY.BIN
+
+PLFLAGS=-DMEMBASEADDR=$(MEMBASEADDR) -DMEMISOSTART=$(MEMISOSTART) -DMEMISOSIZE=$(MEMISOSIZE)
+PLFLAGS+=-DRESTARTSTART=$(RESTARTSTART)
Index: /trunk/platform/s5is/sub/101a/stubs_asm.h
===================================================================
--- /trunk/platform/s5is/sub/101a/stubs_asm.h	(revision 511)
+++ /trunk/platform/s5is/sub/101a/stubs_asm.h	(revision 511)
@@ -0,0 +1,20 @@
+    .text
+
+#define DEF(n,a) \
+    .globl n; n = a
+
+#define NSTUB(name, addr)\
+    .globl _##name ;\
+    .weak _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define NHSTUB(name, addr)\
+    .globl _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define STUB(addr)\
+    .globl sub_ ## addr ;\
+    sub_ ## addr: ;\
+	ldr  pc, =0x ## addr
Index: /trunk/platform/s5is/sub/101a/lib.c
===================================================================
--- /trunk/platform/s5is/sub/101a/lib.c	(revision 511)
+++ /trunk/platform/s5is/sub/101a/lib.c	(revision 511)
@@ -0,0 +1,74 @@
+#include "platform.h"
+
+// Documentation stripped, please refer to the S5IS 1.01b lib.c if you
+// need it, or wait until someone feels like updating the documentation for this
+// particular model.
+
+void *hook_raw_fptr()
+{
+	return (void*)0; // What does this do? Doesn't seem to be called
+}
+
+void *hook_raw_ret_addr()
+{
+	return (void*)0; // What does this do? Doesn't seem to be called
+}
+
+char *hook_raw_image_addr()
+{
+	return (char*)0x1163B8E0;
+}
+
+long hook_raw_size()
+{
+	return 0x9DCCE0;
+}
+
+void *vid_get_viewport_live_fb()
+{
+	return (void*)0x0;
+}
+
+void *vid_get_bitmap_fb()
+{
+	return (void*)0x10361000; 
+}
+
+void *vid_get_viewport_fb()
+{
+	return (void*)0x10D29360;
+}
+
+void *vid_get_viewport_fb_d()
+{
+	return (void*)(*(int*)0x5724);  // 0x56D8 + 0x4C
+}
+
+
+long vid_get_bitmap_screen_width()
+{
+	return 360;
+}
+
+long vid_get_bitmap_screen_height()
+{
+	return 240;
+}
+
+long vid_get_viewport_height()
+{
+	return 240;
+}
+
+char *camera_jpeg_count_str()
+{
+	return (char*)0x58304;
+}
+int movie_status = 0;
+
+
+
+
+long vid_get_bitmap_buffer_width() { return 360; }
+
+long vid_get_bitmap_buffer_height() { return 240; }
Index: /trunk/platform/s5is/sub/101a/stubs_auto.S
===================================================================
--- /trunk/platform/s5is/sub/101a/stubs_auto.S	(revision 511)
+++ /trunk/platform/s5is/sub/101a/stubs_auto.S	(revision 511)
@@ -0,0 +1,250 @@
+/* THIS FILE IS GENERATED */
+/* DO NOT EDIT THIS FILE! */
+
+#include "stubs_asm.h"
+
+STUB(FF81000C)
+STUB(FF8101B8)
+STUB(FF810970)
+STUB(FF810FCC)
+STUB(FF8114E4)
+STUB(FF812D84)
+STUB(FF813594)
+STUB(FF814A30)
+STUB(FF814B1C)
+STUB(FF814F00)
+STUB(FF8150D8)
+STUB(FF81521C)
+STUB(FF819580)
+STUB(FF819898)
+STUB(FF81B860)
+STUB(FF81B930)
+STUB(FF81B9C4)
+STUB(FF81BC54)
+STUB(FF81BC9C)
+STUB(FF81BCD0)
+STUB(FF81BCF4)
+STUB(FF81BD18)
+STUB(FF81BD94)
+STUB(FF81DAB8)
+STUB(FF820E14)
+STUB(FF820F1C)
+STUB(FF821314)
+STUB(FF8227F0)
+STUB(FF82296C)
+STUB(FF822A60)
+STUB(FF822D8C)
+STUB(FF823188)
+STUB(FF82369C)
+STUB(FF8236F8)
+STUB(FF824840)
+STUB(FF824DA0)
+STUB(FF824DCC)
+STUB(FF824DE0)
+STUB(FF8269C4)
+STUB(FF826A50)
+STUB(FF826AB0)
+STUB(FF826D18)
+STUB(FF826D60)
+STUB(FF827068)
+STUB(FF829DA0)
+STUB(FF829FD4)
+STUB(FF82A33C)
+STUB(FF82A370)
+STUB(FF82A5C0)
+STUB(FF82AA98)
+STUB(FF82AC8C)
+STUB(FF82ACE0)
+STUB(FF82CCBC)
+STUB(FF82CEF0)
+STUB(FF82CFC8)
+STUB(FF82D0E0)
+STUB(FF82D130)
+STUB(FF82DB84)
+STUB(FF82DB94)
+STUB(FF82DBB4)
+STUB(FF82DD18)
+STUB(FF82DDAC)
+STUB(FF82DE04)
+STUB(FF82DEC0)
+STUB(FF82DF30)
+STUB(FF82DF54)
+STUB(FF82E074)
+STUB(FF82E638)
+STUB(FF82E758)
+STUB(FF82E7C8)
+STUB(FF82E82C)
+STUB(FF82E838)
+STUB(FF82E86C)
+STUB(FF82EBCC)
+STUB(FF842464)
+STUB(FF8505BC)
+STUB(FF850AD8)
+STUB(FF8561C8)
+STUB(FF8565A8)
+STUB(FF8565E8)
+STUB(FF8566AC)
+STUB(FF856814)
+STUB(FF856880)
+STUB(FF8569D8)
+STUB(FF856F70)
+STUB(FF857088)
+STUB(FF85FD44)
+STUB(FF861FF0)
+STUB(FF862008)
+STUB(FF864270)
+STUB(FF864C5C)
+STUB(FF865098)
+STUB(FF865D68)
+STUB(FF86614C)
+STUB(FF866404)
+STUB(FF8664A0)
+STUB(FF86672C)
+STUB(FF866844)
+STUB(FF867014)
+STUB(FF8670FC)
+STUB(FF867E24)
+STUB(FF868504)
+STUB(FF868688)
+STUB(FF868B08)
+STUB(FF869C60)
+STUB(FF869CD0)
+STUB(FF869F98)
+STUB(FF869FC0)
+STUB(FF86A128)
+STUB(FF870C80)
+STUB(FF87160C)
+STUB(FF87178C)
+STUB(FF872B20)
+STUB(FF874864)
+STUB(FF8749E4)
+STUB(FF874BD8)
+STUB(FF874CD0)
+STUB(FF875078)
+STUB(FF8750A4)
+STUB(FF875A00)
+STUB(FF8761C8)
+STUB(FF877B44)
+STUB(FF878A9C)
+STUB(FF878E50)
+STUB(FF878E74)
+STUB(FF878EE4)
+STUB(FF8795D0)
+STUB(FF879608)
+STUB(FF8796A8)
+STUB(FF8796DC)
+STUB(FF879708)
+STUB(FF8797F4)
+STUB(FF8798D4)
+STUB(FF8799F0)
+STUB(FF879F10)
+STUB(FF879F70)
+STUB(FF879FD0)
+STUB(FF87A1CC)
+STUB(FF87A408)
+STUB(FF87A7CC)
+STUB(FF87A8D4)
+STUB(FF87AA80)
+STUB(FF87ABE8)
+STUB(FF87AD50)
+STUB(FF87AFF8)
+STUB(FF87B17C)
+STUB(FF87B1AC)
+STUB(FF87B1D0)
+STUB(FF87B644)
+STUB(FF87B680)
+STUB(FF87B720)
+STUB(FF87B850)
+STUB(FF87B930)
+STUB(FF87BBA4)
+STUB(FF87BBE4)
+STUB(FF87BC5C)
+STUB(FF87BCC0)
+STUB(FF87BE10)
+STUB(FF87BF2C)
+STUB(FF87C040)
+STUB(FF87C07C)
+STUB(FF87C0B8)
+STUB(FF87C0E8)
+STUB(FF87C154)
+STUB(FF87C3D8)
+STUB(FF87C448)
+STUB(FF87CAAC)
+STUB(FF87CE00)
+STUB(FF87CEE4)
+STUB(FF87D06C)
+STUB(FF87D210)
+STUB(FF87D248)
+STUB(FF87D3A0)
+STUB(FF87DCA0)
+STUB(FF87E098)
+STUB(FF87E1B0)
+STUB(FF87E284)
+STUB(FF87E5A0)
+STUB(FF87E5AC)
+STUB(FF87F8DC)
+STUB(FF88105C)
+STUB(FF882328)
+STUB(FF882C38)
+STUB(FF883DD0)
+STUB(FF886C08)
+STUB(FF888240)
+STUB(FF888250)
+STUB(FF89A6F0)
+STUB(FF89C720)
+STUB(FF89F050)
+STUB(FF8AF7D0)
+STUB(FF8B0F7C)
+STUB(FF8BA414)
+STUB(FF8BA418)
+STUB(FF8BA498)
+STUB(FF8BA544)
+STUB(FF8BA5C4)
+STUB(FF91C114)
+STUB(FF9275B4)
+STUB(FF92765C)
+STUB(FF933D88)
+STUB(FF9445D4)
+STUB(FF95EF2C)
+STUB(FF95F15C)
+STUB(FF95F164)
+STUB(FF95F16C)
+STUB(FF95F190)
+STUB(FF95F2C4)
+STUB(FF95F354)
+STUB(FF95F3D8)
+STUB(FF95F574)
+STUB(FF95F628)
+STUB(FF95F670)
+STUB(FF95F6D4)
+STUB(FF95F8B8)
+STUB(FF95FC9C)
+STUB(FF95FEE8)
+STUB(FF9600E4)
+STUB(FF9601C8)
+STUB(FF96027C)
+STUB(FF9604E8)
+STUB(FF9604F4)
+STUB(FF96062C)
+STUB(FF9606E0)
+STUB(FF960724)
+STUB(FF960778)
+STUB(FF960898)
+STUB(FF96092C)
+STUB(FF9609E0)
+STUB(FF960B34)
+STUB(FF960F84)
+STUB(FF961054)
+STUB(FF9613DC)
+STUB(FF96143C)
+STUB(FF961874)
+STUB(FF961960)
+STUB(FF9619B0)
+STUB(FF9732E0)
+STUB(FF9733B8)
+STUB(FF9D03DC)
+STUB(FF9D03E4)
+STUB(FF9D03EC)
+STUB(FF9D03F4)
+STUB(FFA40388)
+STUB(FFA92D04)
Index: /trunk/platform/s5is/sub/101a/Makefile
===================================================================
--- /trunk/platform/s5is/sub/101a/Makefile	(revision 511)
+++ /trunk/platform/s5is/sub/101a/Makefile	(revision 511)
@@ -0,0 +1,6 @@
+topdir=../../../../
+
+OBJS=boot.o stubs_min.o stubs_auto.o stubs_entry.o lib.o stubs_entry_2.o capt_seq.o
+STUBS_AUTO_DEPS=boot.c capt_seq.c
+
+include $(topdir)/platform/makefile_sub.inc
Index: /trunk/platform/s5is/sub/101b/capt_seq.c
===================================================================
--- /trunk/platform/s5is/sub/101b/capt_seq.c	(revision 511)
+++ /trunk/platform/s5is/sub/101b/capt_seq.c	(revision 511)
@@ -0,0 +1,1028 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+#define RAWDATA_AVAILABLE (1)
+#define RAWDATA_SAVED (2)
+
+#define NR_ON (2)
+#define NR_OFF (1)
+
+static long raw_save_stage;
+
+void capt_seq_hook_raw_here()
+{
+    raw_save_stage = RAWDATA_AVAILABLE;
+    core_rawdata_available();
+    while (raw_save_stage != RAWDATA_SAVED){
+	_SleepTask(10);
+    }
+}
+
+void hook_raw_save_complete()
+{
+    raw_save_stage = RAWDATA_SAVED;
+}
+
+
+void capt_seq_hook_set_nr()
+{
+    long *nrflag = (long*)0xB704;
+
+    switch (core_get_noise_reduction_value()){
+    case NOISE_REDUCTION_AUTO_CANON:
+	// leave it alone
+	break;
+    case NOISE_REDUCTION_OFF:
+	*nrflag = 1;
+	break;
+    case NOISE_REDUCTION_ON:
+	*nrflag = 2;
+	break;
+    };
+}
+
+
+///////////////////////////////////////////////
+// Captseqtask bypass
+// Functions are left intact, no jumps back to original firmware. Code is
+// currently 40 kB (including comments, whitespace and such), about 11 kB 
+// (including comments, whitespace and such) can be saved, so roughly 1/4.
+// This is probably not worth it, as full functions might make debugging easier.
+///////////////////////////////////////////////
+
+void __attribute__((naked,noinline)) sub_FF826988_my() { // called from init things
+     asm volatile (
+          "STMFD   SP!, {R4,LR}\n"
+          "LDR     R4, =0x1D6C\n"
+          "MOV     R0, #0\n"
+          "MOV     R1, #4\n"
+          "STR     R0, [R4,#8]\n"
+          "BL      sub_FF81BC2C\n"
+          "STR     R0, [R4]\n"
+          "MOV     R0, #0\n"
+          "MOV     R1, #1\n"
+          "BL      sub_FF81BC50\n"
+          "STR     R0, [R4,#4]\n"
+          "BL      sub_FF869C08\n"
+          "BL      sub_FF868A40\n"
+//          "BL      sub_FF865CA0\n"               // Taskcreate_captseqtask called from this one
+          "BL      sub_FF865CA0_my\n"               // Taskcreate_captseqtask called from this one
+          "BL      sub_FF869ED0\n"
+          "LDR     R0, [R4]\n"
+          "LDMFD   SP!, {R4,LR}\n"
+          "MOV     R1, #0x1000\n"
+          "B       sub_FF82A274\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF865CA0_my() {
+     asm volatile (
+
+          "STMFD   SP!, {R3-R5,LR}\n"
+          "LDR     R4, =0x59AC\n"
+          "LDR     R0, [R4,#0x20]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF865D74\n"
+          //"BL      nullsub_20\n"
+          "MOV     R1, #1\n"
+          "MOV     R0, #0\n"
+          "BL      sub_FF81BC50\n"
+          "STR     R0, [R4,#0x38]\n"
+          "MOV     R0, #0\n"
+          "MOV     R1, #0\n"
+          "BL      sub_FF81BC2C\n"
+          "STR     R0, [R4,#0x3C]\n"
+          "BL      sub_FF866084\n"
+          "MOV     R1, #0x14\n"
+          "MOV     R0, #0\n"
+          "BL      sub_FF81BC08\n"
+          "STR     R0, [R4,#0x2C]\n"
+          "MOV     R0, #0\n"
+          "MOV     R1, #1\n"
+          "BL      sub_FF81BC50\n"
+          "MOV     R1, #0\n"
+          "STR     R0, [R4]\n"
+          "BL      sub_FF81B798\n" // TakeSemaphore
+          "LDR     R1, =0x1AA6C\n"
+          "MOV     R0, #0\n"
+          "MOV     R5, #0\n"
+
+     "loc_FF865D10:\n"                           // CODE XREF: sub_FF865CA0+80j
+          "ADD     R2, R1, R0,LSL#4\n"
+          "ADD     R0, R0, #1\n"
+          "CMP     R0, #6\n"
+          "STR     R5, [R2,#0xC]\n"
+          "BCC     loc_FF865D10\n"
+          "STR     R5, [R4,#0x30]\n"
+          "LDR     R0, [R4]\n"
+          "BL      sub_FF81B868\n" // GiveSemaphore
+          "MOV     R3, #0\n"
+          "STR     R3, [SP,#0x10-0x10]\n"
+          //"ADR     R3, ShootSeqTask\n"
+          "LDR     R3, =0xFF865C24\n" // ShootSeqTask
+          "MOV     R2, #0x1000\n"
+          "MOV     R1, #0x17\n"
+          //"ADR     R0, aShootseqtask\n"          // \"ShootSeqTask\"
+          "LDR     R0, =0xFF865F88\n" // aShootseqtask
+          "BL      sub_FF81BBD4\n"
+          "LDR     R0, =0x59EC\n"
+          "MOV     R1, #0\n"
+          "STR     R5, [R4,#0x34]\n"
+          "STR     R1, [R0],#4\n"
+          "STR     R1, [R0]\n"
+          "BL      sub_FF86633C\n"
+          "BL      sub_FF86A060\n"
+          "BL      sub_FF86843C\n"
+//          "BL      sub_FF866F4C\n" // taskcreate_CaptSeqTask
+          "BL      sub_FF866F4C_my\n" // bypass taskcreate_CaptSeqTask
+          "BL      sub_FF867D5C\n"
+
+     "loc_FF865D74:\n"                           // CODE XREF: sub_FF865CA0+10j
+          "MOV     R0, #1\n"
+          "STR     R0, [R4,#0x20]\n"
+          "LDMFD   SP!, {R3-R5,PC}\n"
+
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF866F4C_my() {
+     asm volatile (
+          "STMFD   SP!, {R3-R5,LR}\n"
+          "LDR     R2, =0x1AC04\n"
+          "MOV     R0, #0\n"
+          "MOV     R1, #0\n"
+
+     "loc_FF866F5C:\n"                           // CODE XREF: taskcreate_CaptSeqTask+20j
+          "ADD     R3, R2, R0,LSL#4\n"
+          "ADD     R0, R0, #1\n"
+          "CMP     R0, #5\n"
+          "STR     R1, [R3,#8]\n"
+          "BCC     loc_FF866F5C\n"
+          "LDR     R0, =0x1AC54\n"
+          "STR     R1, [R0,#8]\n"
+          "ADD     R0, R0, #0x10\n"
+          "STR     R1, [R0,#8]\n"
+          "BL      sub_FF95F60C\n"
+          "BL      sub_FF961898\n"
+          "MOV     R1, #5\n"
+          "MOV     R0, #0\n"
+          "BL      sub_FF81BC08\n"
+          "LDR     R4, =0x5A14\n"
+          "LDR     R1, =0x1001FF\n"
+          "STR     R0, [R4,#0x14]\n"
+          "MOV     R0, #0\n"
+          "BL      sub_FF81BC2C\n"
+          "STR     R0, [R4,#0x10]\n"
+          "MOV     R3, #0\n"
+          "STR     R3, [SP,#0x10-0x10]\n"
+          //"ADR     R3, CaptSeqTask\n"
+          "ADR     R3, sub_FF866C80_my\n" // bypass CaptSeqTask
+          //"ADR     R0, aCaptseqtask\n"           // \"CaptSeqTask\"
+          "LDR     R0, =0xFF867160\n" // "CaptSeqTask"
+          "MOV     R2, #0x1000\n"
+          "MOV     R1, #0x17\n"
+          "BL      sub_FF81BBD4\n"
+          "LDMFD   SP!, {R3-R5,PC}\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF866C80_my() {
+     asm volatile (
+          "STMFD   SP!, {R3-R9,LR}\n"
+          "LDR     R6, =0x1AC98\n"
+          "LDR     R5, =0x5A14\n"
+          "MOV     R9, #1\n"
+          "MOV     R7, #0\n"
+
+     "loc_FF866C94:\n"                           // CODE XREF: CaptSeqTask+2C8j
+          "LDR     R0, [R5,#0x14]\n"
+          "MOV     R2, #0\n"
+          "MOV     R1, SP\n"
+          "BL      sub_FF82A4F8\n"
+          "TST     R0, #1\n"
+          "BEQ     loc_FF866CC0\n"
+          "LDR     R1, =0x415\n"
+          "LDR     R0, =0xFF866700\n" //aSsshoottask_c\n"
+          "BL      sub_FF81BCCC\n" //assert\n"
+          "BL      sub_FF81BB8C\n" //ExitTask\n"
+          "LDMFD   SP!, {R3-R9,PC}\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866CC0:\n"                           // CODE XREF: CaptSeqTask+28j
+          "LDR     R0, [SP,#0x20-0x20]\n"
+          "LDR     R1, [R0]\n"
+          "CMP     R1, #0x1B\n"
+          "ADDLS   PC, PC, R1,LSL#2\n"
+          "B       loc_FF866F10\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866CD4:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866D44\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866CD8:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866DB4\n"													// Entry 1: After shooting, while doing darkframesub (after shutter button?)
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866CDC:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866DBC\n"													// Entry 2: After shutter button release when already done shooting pic
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866CE0:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866DD4\n"													// Entry 3: If shutter button not pressed
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866CE4:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866DC8\n"													// Entry 4: In timed image review
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866CE8:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866DDC\n"													// Entry 5: In detailed image review
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866CEC:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866DE4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866CF0:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866DEC\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866CF4:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866E44\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866CF8:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866E50\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866CFC:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866E58\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866D00:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866E60\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866D04:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866E68\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866D08:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866E70\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866D0C:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866E78\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866D10:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866E80\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866D14:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866E88\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866D18:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866E90\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866D1C:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866E98\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866D20:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866EA0\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866D24:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866EA8\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866D28:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866EB4\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866D2C:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866EC0\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866D30:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866EC8\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866D34:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866EF8\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866D38:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866F00\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866D3C:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866F08\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866D40:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866D44:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 0\n"
+          "BL      sub_FF95F0C8\n"
+          "BL      sub_FF864B94\n"
+          "LDR     R0, [R6,#0x24]\n"
+          "CMP     R0, #0\n"
+          "BEQ     loc_FF866F1C\n"
+          "BL      sub_FF8663D8\n"
+          "MOV     R4, R0\n"
+          "LDR     R0, [R6,#0x24]\n"
+          "CMP     R0, #0\n"
+          "BEQ     loc_FF866D8C\n"
+          "MOV     R0, #0xC\n"
+          "BL      sub_FF869B98\n"
+          "TST     R0, #1\n"
+          "STRNE   R9, [R5,#4]\n"
+          "LDRNE   R0, [R4,#8]\n"
+          "ORRNE   R0, R0, #0x40000000\n"
+          "STRNE   R0, [R4,#8]\n"
+          "BNE     loc_FF866F1C\n"
+
+     "loc_FF866D8C:\n"                           // CODE XREF: CaptSeqTask+E8j
+          "MOV     R0, R4\n"
+          "BL      sub_FF960A6C\n"
+          "BL      sub_FF9732F0\n"
+          "BL      sub_FF87491C\n"
+          "STR     R0, [R4,#0x14]\n"
+          "MOV     R0, R4\n"
+          "BL      sub_FF960F8C\n"
+          "TST     R0, #1\n"
+          "STRNE   R9, [R5,#4]\n"
+          "B       loc_FF866F1C\n"
+
+     "loc_FF866DB4:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 1\n"       // According to the A720IS firmware, this is done after relasing the shutter (button?)
+//          "BL      sub_FF86677C\n"             // Bypass this and the camera will not properly shoot a picture, it will beep after a bit
+          "BL      sub_FF86677C_my\n"
+          "B       loc_FF866DCC\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DBC:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 2\n"
+          "MOV     R0, #1\n"
+          "BL      sub_FF95F310\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DC8:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 4\n"
+          "BL      sub_FF95EE64\n"
+
+     "loc_FF866DCC:\n"                           // CODE XREF: CaptSeqTask+138j
+          "STR     R7, [R6,#0x24]\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DD4:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 3\n"       // Points to prepareseq.c
+          "BL      sub_FF95F094\n"
+          "B       loc_FF866DCC\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DDC:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 5\n"       // Points to prepareseq.c
+          "BL      sub_FF95F09C\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DE4:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 6\n"
+          "BL      sub_FF95F1FC\n"
+          "B       loc_FF866E48\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866DEC:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 7\n"
+          "LDR     R4, [R0,#0xC]\n"
+          "BL      sub_FF95F0A4\n" //UiEvnt_StartDisguiseCradleStatus_4\n"
+          "MOV     R0, R4\n"
+          "BL      sub_FF95FBD4\n"
+          "TST     R0, #1\n"
+          "MOV     R8, R0\n"
+          "BNE     loc_FF866E2C\n"
+          "BL      sub_FF87491C\n"
+          "STR     R0, [R4,#0x14]\n"
+          "MOV     R0, R4\n"
+          "BL      sub_FF960EBC\n"
+          "MOV     R0, R4\n"
+          "BL      sub_FF961374\n"
+          "MOV     R8, R0\n"
+          "LDR     R0, [R4,#0x14]\n"
+          "BL      sub_FF874B10\n"
+
+     "loc_FF866E2C:\n"                           // CODE XREF: CaptSeqTask+184j
+          "BL      sub_FF95F094\n"
+          "MOV     R2, R4\n"
+          "MOV     R1, #7\n"
+          "MOV     R0, R8\n"
+          "BL      sub_FF864FD0\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866E44:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 8\n"
+          "BL      sub_FF95F28C\n"
+
+     "loc_FF866E48:\n"                           // CODE XREF: CaptSeqTask+168j
+          "BL      sub_FF864B94\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866E50:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 9\n"
+          "BL      sub_FF95F094\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866E58:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 10\n"
+          "BL      sub_FF95FE20\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866E60:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 11\n"
+          "BL      sub_FF96001C\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866E68:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 12\n"
+          "BL      sub_FF960100\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866E70:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 13\n"
+          "BL      sub_FF9601B4\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866E78:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 14\n"
+          "BL      sub_FF960618\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866E80:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 15\n"
+          "BL      sub_FF96065C\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866E88:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 16\n"
+          "MOV     R0, #0\n"
+          "B       loc_FF866EAC\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866E90:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 17\n"
+          "BL      sub_FF9607D0\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866E98:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 18\n"
+          "BL      sub_FF960864\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866EA0:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 19\n"
+          "BL      sub_FF960918\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866EA8:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 20\n"
+          "MOV     R0, #1\n"
+
+     "loc_FF866EAC:\n"                           // CODE XREF: CaptSeqTask+20Cj
+          "BL      sub_FF9606B0\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866EB4:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 21\n"
+          "BL      sub_FF95F4AC\n"
+          "BL      sub_FF867034\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866EC0:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 22\n"
+          "BL      sub_FF96042C\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866EC8:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 23\n"
+          "MOV     R2, #2\n"
+          "ADD     R1, R6, #0x58\n"
+          "MOV     R0, #0x6F\n"
+          "BL      sub_FF87479C\n"
+          "TST     R0, #1\n"
+          "LDRNE   R0, =0xFF866700\n" //aSsshoottask_c\n"
+          "MOVNE   R1, #0x4D0\n"
+          "BLNE    sub_FF81BCCC\n" //assert\n"
+          "LDRH    R0, [R6,#0x58]\n"
+          "CMP     R0, #1\n"
+          "BLEQ    sub_FF960420\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866EF8:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 24\n"
+          "BL      sub_FF960564\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866F00:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 25\n"
+          "BL      sub_FF866664\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866F08:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 26\n"
+          "BL      sub_FF8268FC\n"
+          "B       loc_FF866F1C\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866F10:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC default entry\n"
+          "LDR     R1, =0x4F1\n"
+          "LDR     R0, =0xFF866700\n" //aSsshoottask_c\n"
+          "BL      sub_FF81BCCC\n" //assert\n"
+
+     "loc_FF866F1C:\n"                           // CODE XREF: CaptSeqTask+4Cj
+          "@ jumptable FF866CCC entry 27\n"
+          "LDR     R0, [SP,#0x20-0x20]\n"
+          "LDR     R1, [R0,#4]\n"
+          "LDR     R0, [R5,#0x10]\n"
+          "BL      sub_FF82A274\n"
+          "LDR     R4, [SP,#0x20-0x20]\n"
+          "LDR     R0, [R4,#8]\n"
+          "CMP     R0, #0\n"
+          "LDREQ   R0, =0xFF866700\n" //aSsshoottask_c\n"
+          "MOVEQ   R1, #0xF7\n"
+          "BLEQ    sub_FF81BCCC\n" //assert\n"
+          "STR     R7, [R4,#8]\n"
+          "B       loc_FF866C94\n"
+     ".ltorg\n"
+     );
+}
+
+
+void __attribute((naked,noinline)) sub_FF86677C_my() {
+     asm volatile (
+          "STMFD   SP!, {R4-R8,LR}\n"
+          "LDR     R4, [R0,#0xC]\n"
+          "LDR     R5, =0x1AC98\n"
+          "LDR     R0, [R4,#8]\n"
+          "LDR     R6, =0x820A\n"
+          "ORR     R0, R0, #1\n"
+          "STR     R0, [R4,#8]\n"
+          "LDRH    R0, [R5]\n"
+          "LDR     R8, =0x5A14\n"
+          "MOV     R7, #0\n"
+          "CMP     R0, R6\n"
+          "BEQ     loc_FF866820\n"
+          "LDRH    R0, [R5,#0x88]\n"
+          "CMP     R0, #3\n"
+          "BEQ     loc_FF866874\n"
+          "LDR     R0, [R4,#0xC]\n"
+          "CMP     R0, #1\n"
+          "BLS     loc_FF86682C\n"
+          "LDRH    R0, [R5,#0x86]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF866874\n"
+          "LDRH    R0, [R5,#0x82]\n"
+          "CMP     R0, #2\n"
+          "BNE     loc_FF866838\n"
+          "BL      sub_FF95F560\n"
+          "LDRH    R0, [R5]\n"
+          "CMP     R0, R6\n"
+          "BEQ     loc_FF866820\n"
+          "LDRH    R0, [R5,#0x88]\n"
+          "CMP     R0, #3\n"
+          "BEQ     loc_FF866874\n"
+          "LDR     R0, [R4,#0xC]\n"
+          "CMP     R0, #1\n"
+          "BLS     loc_FF86682C\n"
+          "LDRH    R0, [R5,#0x86]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF866874\n"
+          "LDRH    R0, [R5,#0x82]\n"
+          "CMP     R0, #2\n"
+          "BEQ     loc_FF866864\n"
+          "B       loc_FF866838\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF866820:\n"                           // CODE XREF: sub_FF86677C+2Cj
+          " \n"                                  // sub_FF86677C+6Cj
+          "LDRH    R0, [R5,#0x88]\n"
+          "CMP     R0, #3\n"
+          "BEQ     loc_FF866874\n"
+
+     "loc_FF86682C:\n"                           // CODE XREF: sub_FF86677C+44j
+          " \n"                                  // sub_FF86677C+84j
+          "LDRH    R0, [R5,#0x86]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF866874\n"
+
+     "loc_FF866838:\n"                           // CODE XREF: sub_FF86677C+5Cj
+          " \n"                                  // sub_FF86677C+A0j
+          "LDRH    R0, [R5,#0x82]\n"
+          "CMP     R0, #1\n"
+          "BNE     loc_FF866874\n"
+          "LDRH    R0, [R5]\n"
+          "CMP     R0, R6\n"
+          "LDRNE   R0, [R4,#0xC]\n"
+          "CMPNE   R0, #1\n"
+          "BLS     loc_FF866874\n"
+          "LDR     R0, [R4,#0x10]\n"
+          "CMP     R0, #1\n"
+          "BNE     loc_FF866874\n"
+
+     "loc_FF866864:\n"                           // CODE XREF: sub_FF86677C+9Cj
+          "LDR     R2, =0xEA60\n"
+          "LDR     R0, [R8,#0x10]\n"
+          "MOV     R1, #0x40000000\n"
+          "BL      sub_FF869EF8\n"
+
+     "loc_FF866874:\n"                           // CODE XREF: sub_FF86677C+38j
+          " \n"                                  // sub_FF86677C+50j ...
+          "BL      sub_FF866664\n"
+          "LDR     R0, [R5,#0x24]\n"
+          "CMP     R0, #0\n"
+          "MOVEQ   R0, #2\n"
+          "BLEQ    sub_FF85FC7C\n"
+          "BL      sub_FF95F0A4\n" // UiEvnt_StartDisguiseCradleStatus_4\n"
+          "LDR     R0, [R4,#0x18]\n"
+          "CMP     R0, #0\n"
+          "BLNE    sub_FF861F28\n"
+          "LDR     R0, [R5,#0x24]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF8668F0\n"
+          "MOV     R0, R4\n"
+          "BL      sub_FF960A6C\n"
+          "MOV     R0, R4\n"
+          "BL      sub_FF95F7F0\n"
+          "TST     R0, #1\n"
+          "MOVNE   R2, R4\n"
+//          "LDMFDNE SP!, {R4-R8,LR}\n"
+          "LDMNEFD SP!, {R4-R8,LR}\n"
+          "MOVNE   R1, #1\n"
+          "BNE     sub_FF864FD0\n"
+          "BL      sub_FF9732F0\n"
+
+          "BL      shooting_expo_param_override\n"  // +-----------> Override Canon stuff :)
+
+          "BL      sub_FF87491C\n"
+          "STR     R0, [R4,#0x14]\n"
+          "MOV     R0, R4\n"
+          "BL      sub_FF960EBC\n"
+          "BL      sub_FF9617AC\n"
+          "MOV     R0, R4\n"
+//          "BL      sub_FF960F8C\n" // This is where shooting AND darkframe sub is done
+          "BL      sub_FF960F8C_my\n" // so hook it
+          "MOV     R7, R0\n"
+
+          "BL      capt_seq_hook_raw_here\n" // +-----------> Capture RAW, camera already did badpixel-sub (always) though some pixels are still there
+
+          "B       loc_FF8668FC\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF8668F0:\n"                           // CODE XREF: sub_FF86677C+124j
+          "LDR     R0, [R8,#4]\n"
+          "CMP     R0, #0\n"
+          "MOVNE   R7, #0x1D\n"
+
+     "loc_FF8668FC:\n"                           // CODE XREF: sub_FF86677C+170j
+          "MOV     R2, R4\n"
+          "MOV     R1, #1\n"
+          "MOV     R0, R7\n"
+          "BL      sub_FF864FD0\n"
+          "BL      sub_FF961314\n"
+          "CMP     R0, #0\n"
+          "LDRNE   R0, [R4,#8]\n"
+          "ORRNE   R0, R0, #0x2000\n"
+          "STRNE   R0, [R4,#8]\n"
+          "LDR     R0, [R4,#0x18]\n"
+          "CMP     R0, #0\n"
+          "BLNE    sub_FF861F40\n"
+          "LDRH    R0, [R5,#0x88]\n"
+          "CMP     R0, #3\n"
+//          "LDMFDEQ SP!, {R4-R8,PC}\n"
+          "LDMEQFD SP!, {R4-R8,PC}\n"
+          "LDRH    R0, [R5,#0x86]\n"
+          "CMP     R0, #0\n"
+//          "LDRHEQ  R0, [R5,#0x82]\n"
+          "LDREQH  R0, [R5,#0x82]\n"
+          "CMPEQ   R0, #2\n"
+          "MOVEQ   R0, R4\n"
+//          "LDMFDEQ SP!, {R4-R8,LR}\n"
+          "LDMEQFD SP!, {R4-R8,LR}\n"
+          "BEQ     sub_FF95F5A8\n"
+          "LDMFD   SP!, {R4-R8,PC}\n"
+	".ltorg\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF960F8C_my() {
+     asm volatile (
+          "STMFD   SP!, {R0-R8,LR}\n"
+          "MOV     R4, R0\n"
+          "BL      sub_FF9618E8\n"
+          "MVN     R1, #0\n"
+          "BL      sub_FF82A2A8\n"
+          "MOV     R2, #4\n"
+          "ADD     R1, SP, #0x28-0x20\n"
+          "MOV     R0, #0x8A\n"
+          "BL      sub_FF87479C\n"
+          "TST     R0, #1\n"
+          "LDRNE   R1, =0x1D2\n"
+//          "ADRNE   R0, aSscaptureseq_c\n"        // \"SsCaptureSeq.c\"
+          "LDRNE   R0, =0xFF9611A4\n"
+          "BLNE    sub_FF81BCCC\n" // assert\n"
+          "LDR     R6, =0x1AD48\n"
+          "LDR     R7, =0x1AC98\n"
+          "LDRSH   R1, [R6,#0xE]\n"
+          "LDR     R0, [R7,#0x7C]\n"
+//          "BL      nullsub_70\n"
+          "BL      sub_FF8504F4\n" //GetCCDTemperature\n"
+          "LDR     R2, =0xB708\n"
+          "ADD     R3, R4, #0x78\n"
+          "STRH    R0, [R4,#0x74]\n"
+//          "STRD    R2, [SP,#0x28-0x28]\n"  // WORKSFORME, configure gcc WITHOUT --with-cpu=arm9
+          "STR    R2, [SP,#0x28-0x28]\n"     // Though use the old, 2-line version
+          "STR    R3, [SP,#0x28-0x24]\n"     // for the final until everyone uses 'new' gcc
+          "MOV     R1, R0\n"
+          "LDRH    R0, [R7,#0x54]\n"
+          "LDRSH   R2, [R6,#0xC]\n"
+          "LDR     R3, =0xB704\n"
+
+          "BL      sub_FFA402C0\n" // 2 (NR) is set into 0xB704 in this sub! Still before shooting
+
+          "BL      wait_until_remote_button_is_released\n"
+          "BL      capt_seq_hook_set_nr\n" // +-----------> so immediately override NR
+
+          "LDR     R0, [R4,#0x18]\n"
+          "LDR     R1, =0xB704\n"
+          "CMP     R0, #0\n"
+          "MOV     R8, #1\n"
+          "BEQ     loc_FF96101C\n"
+          "LDR     R0, [R1]\n"
+          "CMP     R0, #2\n"
+          "STREQ   R8, [R1]\n"
+
+     "loc_FF96101C:\n"                           // CODE XREF: sub_FF960F8C+80j
+          "LDR     R0, [R1,#4]\n"
+          "MOV     R5, R1\n"
+          "BL      sub_FF850A10\n"
+          "LDR     R0, [R5]\n"
+          "MOV     R1, #0\n"
+          "CMP     R0, #1\n"
+          "BNE     loc_FF961094\n"
+          "STR     R1, [SP,#0x28-0x1C]\n"
+          "LDR     R0, [R4,#0x14]\n"
+          "MOV     R1, #0x33\n"
+          "MOV     R3, #2\n"
+          "ADD     R2, SP, #0x28-0x1C\n"
+          "BL      sub_FF874C08\n"
+          "LDR     R0, [R4,#8]\n"
+//          "ADR     R3, sub_FF960D20\n"
+          "LDR     R3, =0xFF960D20\n"
+          "ORR     R0, R0, #0x40\n"
+          "STR     R0, [R4,#8]\n"
+          "LDR     R0, [SP,#0x28-0x20]\n"
+          "STR     R4, [SP,#0x28-0x28]\n"
+          "CMP     R0, #0\n"
+          "LDR     R0, [R4,#0x24]\n"
+          "MOV     R2, R4\n"
+//          "ADR     R1, sub_FF960CA0\n"
+          "LDR     R1, =0xFF960CA0\n"
+          "BEQ     loc_FF961084\n"
+          "BL      sub_FF9D0314\n"
+          "B       loc_FF961088\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF961084:\n"                           // CODE XREF: sub_FF960F8C+ECj
+          "BL      sub_FF8BA350\n"
+
+     "loc_FF961088:\n"                           // CODE XREF: sub_FF960F8C+F4j
+          " \n"                                  // sub_FF960F8C+2ACj ...
+          "TST     R0, #1\n"
+          "BEQ     loc_FF96125C\n"
+          "B       loc_FF961244\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF961094:\n"                           // CODE XREF: sub_FF960F8C+A8j
+          "CMP     R0, #2\n"
+          "BNE     loc_FF9611E4\n"
+          "STR     R1, [SP,#0x28-0x28+4]\n" // start shooting with darkframe
+          "STR     R8, [SP,#0x28-0x1C]\n"
+          "LDR     R0, [R4,#0x14]\n"
+          "MOV     R1, #0x33\n"
+          "MOV     R3, #2\n"
+          "ADD     R2, SP, #0x28-0x1C\n"
+          "BL      sub_FF874C08\n"
+          "LDR     R0, [R4,#8]\n"
+          "LDR     R1, =0xFF960CA0\n"
+          "ORR     R0, R0, #0x80\n"
+          "STR     R0, [R4,#8]\n"
+          "LDR     R0, [SP,#0x28-0x20]\n"
+          "STR     R4, [SP,#0x28-0x28]\n"
+          "CMP     R0, #0\n"
+          "LDR     R0, [R4,#0x24]\n"
+//          "ADR     R3, locret_FF960E78\n"
+          "LDR     R3, =0xFF960E78\n"
+          "MOV     R2, R4\n"
+          "BEQ     loc_FF9610EC\n"
+          "BL      sub_FF9D031C\n"
+          "B       loc_FF9610F0\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF9610EC:\n"                           // CODE XREF: sub_FF960F8C+154j
+          "BL      sub_FF8BA3D0\n"
+
+     "loc_FF9610F0:\n"                           // CODE XREF: sub_FF960F8C+15Cj
+          "TST     R0, #1\n"
+          "BNE     loc_FF961244\n"
+          "MOV     R1, #0\n"
+          "MOV     R0, #0x44\n"
+          "BL      sub_FF886B40\n"
+          "LDR     R0, [R4,#8]\n"
+          "ORR     R0, R0, #0x100\n"
+          "STR     R0, [R4,#8]\n"
+          "BL      sub_FF8BA34C\n"
+          "LDR     R0, [SP,#0x28-0x20]\n"
+          "LDR     R1, =0xFF960D20\n"
+          "CMP     R0, #0\n"
+          "LDR     R0, [R4,#0x24]\n"
+          "MOV     R2, R4\n"
+          "BEQ     loc_FF961134\n"
+          "BL      sub_FF9D032C\n"
+          "B       loc_FF961138\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF961134:\n"                           // CODE XREF: sub_FF960F8C+19Cj
+          "BL      sub_FF8BA4FC\n"
+
+     "loc_FF961138:\n"                           // CODE XREF: sub_FF960F8C+1A4j
+          "TST     R0, #1\n"
+          "BNE     loc_FF961244\n"
+          "MOV     R2, #2\n"
+          "ADD     R1, SP, #0x28-0x28+4\n"
+          "MOV     R0, #0xD8\n"
+          "BL      sub_FF87479C\n"
+          "TST     R0, #1\n"
+          "LDRNE   R1, =0x24E\n"
+//          "ADRNE   R0, aSscaptureseq_c\n"        // \"SsCaptureSeq.c\"
+          "LDRNE   R0, =0xFF9611A4\n"
+          "BLNE    sub_FF81BCCC\n" // assert\n"
+          "LDR     R0, [R4,#0x78]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF96125C\n"
+          "LDR     R0, [R6]\n"
+          "CMP     R0, #0\n"
+          "BEQ     loc_FF961184\n"
+          "LDRH    R0, [SP,#0x28-0x28+4]\n"
+          "CMP     R0, #1\n"
+          "BEQ     loc_FF96125C\n"
+
+     "loc_FF961184:\n"                           // CODE XREF: sub_FF960F8C+1E8j
+          "MOV     R1, #0\n"
+          "MOV     R0, #0x45\n"
+          "BL      sub_FF886B40\n"
+          "B       loc_FF96125C\n"
+          "@ ---------------------------------------------------------------------------\n"
+          
+          ".ltorg\n" // Shut up stupid compiler/assembler manually
+          
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF9611E4:\n"                           // CODE XREF: sub_FF960F8C+10Cj
+          "CMP     R0, #3\n"
+          "BNE     loc_FF961250\n"
+          "MOV     R0, #2\n"
+          "STR     R0, [SP,#0x28-0x1C]\n"
+          "LDR     R0, [R4,#0x14]\n"
+          "MOV     R3, #2\n"
+          "ADD     R2, SP, #0x28-0x1C\n"
+          "MOV     R1, #0x33\n"
+          "BL      sub_FF874C08\n"
+          "LDR     R0, [R4,#8]\n"
+          "LDR     R3, =0xFF960D20\n"
+          "ORR     R0, R0, #0x200\n"
+          "STR     R0, [R4,#8]\n"
+          "LDR     R0, [SP,#0x28-0x20]\n"
+          "STR     R4, [SP,#0x28-0x28]\n"
+          "CMP     R0, #0\n"
+          "LDR     R0, [R4,#0x24]\n"
+          "LDR     R1, =0xFF960CA0\n"
+          "MOV     R2, R4\n"
+          "BEQ     loc_FF96123C\n"
+          "BL      sub_FF9D0324\n"
+          "B       loc_FF961088\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF96123C:\n"                           // CODE XREF: sub_FF960F8C+2A4j
+          "BL      sub_FF8BA47C\n"
+          "B       loc_FF961088\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF961244:\n"                           // CODE XREF: sub_FF960F8C+104j
+          " \n"                                  // sub_FF960F8C+168j ...
+          "MOV     R0, #0x1D\n"
+
+     "loc_FF961248:\n"                           // CODE XREF: sub_FF960F8C+384j
+          "ADD     SP, SP, #0x10\n"
+          "LDMFD   SP!, {R4-R8,PC}\n"
+          "@ ---------------------------------------------------------------------------\n"
+
+     "loc_FF961250:\n"                           // CODE XREF: sub_FF960F8C+25Cj
+          "LDR     R1, =0x279\n"
+//          "ADR     R0, aSscaptureseq_c\n"        // \"SsCaptureSeq.c\"
+          "LDR     R0, =0xFF9611A4\n"
+          "BL      sub_FF81BCCC\n" //assert\n"
+
+     "loc_FF96125C:\n"                           // CODE XREF: sub_FF960F8C+100j
+          " \n"                                  // sub_FF960F8C+1DCj ...
+          "LDR     R2, =0xB708\n"
+          "LDR     R0, [R4,#0x14]\n"
+          "MOV     R3, #4\n"
+          "MOV     R1, #0x45\n"
+          "BL      sub_FF874C08\n"
+          "MOV     R0, #1\n"
+          "BL      sub_FF91C04C\n"
+          "STR     R0, [R4,#0x98]\n"
+          "BL      sub_FF8685C0\n"
+          "LDRH    R0, [R7]\n"
+          "LDR     R12, =0x820A\n"
+          "CMP     R0, R12\n"
+//          "LDRHNE  R0, [R7,#0x88]\n"
+          "LDRNEH  R0, [R7,#0x88]\n"
+          "MOVNE   R1, R7\n"
+          "CMPNE   R0, #3\n"
+          "LDRNE   R0, [R4,#0xC]\n"
+          "CMPNE   R0, #1\n"
+          "BLS     loc_FF9612EC\n"
+          "LDRH    R2, [R1,#0x86]\n"
+          "CMP     R2, #0\n"
+          "BNE     loc_FF9612D0\n"
+          "LDRH    R0, [R1,#0x82]\n"
+          "CMP     R0, #1\n"
+          "CMPNE   R0, #2\n"
+          "BEQ     loc_FF9612D0\n"
+          "CMP     R0, #3\n"
+//          "LDRHEQ  R0, [R1,#0x8A]\n"
+          "LDREQH  R0, [R1,#0x8A]\n"
+          "CMPEQ   R0, #2\n"
+          "BNE     loc_FF96130C\n"
+
+     "loc_FF9612D0:\n"                           // CODE XREF: sub_FF960F8C+320j
+          " \n"                                  // sub_FF960F8C+330j
+          "LDR     R0, [R4,#0x10]\n"
+          "CMP     R0, #1\n"
+          "BEQ     loc_FF9612EC\n"
+          "CMP     R2, #0\n"
+//          "LDRHEQ  R0, [R1,#0x82]\n"
+          "LDREQH  R0, [R1,#0x82]\n"
+          "CMPEQ   R0, #2\n"
+          "BNE     loc_FF96130C\n"
+
+     "loc_FF9612EC:\n"                           // CODE XREF: sub_FF960F8C+314j
+          " \n"                                  // sub_FF960F8C+34Cj
+          "BL      sub_FF9618E8\n"
+          "LDR     R2, =0x2710\n"
+          "MOV     R1, #4\n"
+          "BL      sub_FF869EF8\n"
+          "CMP     R0, #0\n"
+          "LDRNE   R1, =0x286\n"
+//          "ADRNE   R0, aSscaptureseq_c\n"        // \"SsCaptureSeq.c\"
+          "LDRNE   R0, =0xFF9611A4\n"
+          "BLNE    sub_FF81BCCC\n" // assert\n"
+
+     "loc_FF96130C:\n"                           // CODE XREF: sub_FF960F8C+340j
+          " \n"                                  // sub_FF960F8C+35Cj
+          "MOV     R0, #0\n"
+          "B       loc_FF961248\n"
+     ".ltorg\n"
+     );
+}
+
Index: /trunk/platform/s5is/sub/101b/stubs_dryos.S
===================================================================
--- /trunk/platform/s5is/sub/101b/stubs_dryos.S	(revision 511)
+++ /trunk/platform/s5is/sub/101b/stubs_dryos.S	(revision 511)
@@ -0,0 +1,2 @@
+
+
Index: /trunk/platform/s5is/sub/101b/stubs_entry_2.S
===================================================================
--- /trunk/platform/s5is/sub/101b/stubs_entry_2.S	(revision 511)
+++ /trunk/platform/s5is/sub/101b/stubs_entry_2.S	(revision 511)
@@ -0,0 +1,187 @@
+#include "stubs_asm.h"
+
+NHSTUB(SleepTask                              ,0xFF82AB58)
+NHSTUB(CreateTask                             ,0xFF81B8FC)
+NHSTUB(ExitTask                               ,0xFF81BB8C)
+NHSTUB(AllocateMemory                         ,0xFFA410A8)
+
+// Look over all these again, some point to a B sub_.... so that's unnecessary.
+NHSTUB(ExecuteEventProcedure                  ,0xFF81BE9C)
+NHSTUB(FreeMemory                             ,0xFFA41094)
+NHSTUB(GetCurrentTargetDistance               ,0xFF9511A4)
+NHSTUB(GetSystemTime                          ,0xFFA411A4)
+NHSTUB(ints_disable                           ,0xFF81058C) // Actually identified as IRQdisable by signatures
+NHSTUB(ints_enable                            ,0xFF8105B4) // Actually identified as IRQenable by signatures
+NHSTUB(memcmp                                 ,0xFF81E664)
+NHSTUB(memcpy                                 ,0xFF8B3200)
+NHSTUB(memset                                 ,0xFFA64B94)
+NHSTUB(Close                                  ,0xFF825CC4)
+NHSTUB(Open                                   ,0xFF825C9C)
+NHSTUB(Read                                   ,0xFF825D6C)
+NHSTUB(Write                                  ,0xFF825D70)
+NHSTUB(Lseek                                  ,0xFF825ECC)
+NHSTUB(strcmp                                 ,0xFF81E5FC)
+NHSTUB(strcpy                                 ,0xFF81E5A8)
+NHSTUB(strlen                                 ,0xFF81E640)
+NHSTUB(TakeSemaphore                          ,0xFF81B798)
+NHSTUB(vsprintf                               ,0xFF81E528)    // first sub called in FADBGPrintf
+NHSTUB(GetFocusLensSubjectDistance            ,0xFF952444)    // returns 0. What's wrong?
+NHSTUB(GetZoomLensCurrentPoint                ,0xFF957CBC)
+NHSTUB(GetZoomLensCurrentPosition             ,0xFF957CC0)
+NHSTUB(RefreshPhysicalScreen                  ,0xFF8B2D90)
+NHSTUB(GetPropertyCase                        ,0xFF87479C)    // PT_GetPropertyCaseString
+NHSTUB(SetPropertyCase                        ,0xFF8746AC)    // PT_SetPropertyCaseString
+NHSTUB(VbattGet                               ,0xFF822204)    
+NHSTUB(GetParameterData                       ,0xFF972F60) // Guess but it seems correct. IDA incorrectly identified sub_FF97245C as GetParameterData
+NHSTUB(SetParameterData                       ,0xFF972ED4) // Idem, with different address though :)
+NHSTUB(IsStrobeChargeCompleted                ,0xFF8DB534)
+
+
+// these (open, write, close) are educated guesses but not 100% certain
+NHSTUB(open                                   ,0xFF819F68)
+NHSTUB(write                                  ,0xFF81A260)
+NHSTUB(close                                  ,0xFF81A018)
+NHSTUB(lseek                                  ,0xFF825E04) // Lseek_0
+NHSTUB(read                                   ,0xFF81A200) // Read
+
+NHSTUB(Fopen_Fut                              ,0xFF825668)
+NHSTUB(Fwrite_Fut                             ,0xFF8257A8)
+NHSTUB(Fclose_Fut                             ,0xFF8256A8)
+NHSTUB(Fread_Fut                              ,0xFF825754)
+NHSTUB(Fseek_Fut                              ,0xFF825848)
+
+NHSTUB(Remove                                 ,0xFF825D0C)
+NHSTUB(rename                                 ,0xFF825D98)
+
+NHSTUB(stat                                   ,0xFF825ED0)
+NHSTUB(openfastdir                            ,0xFFA2786C)
+NHSTUB(readfastdir                            ,0xFFA27900)
+NHSTUB(closefastdir                           ,0xFFA279D0)
+
+NHSTUB(opendir                                ,0xFFA2786C) // OpenFastDir
+NHSTUB(ReadFastDir                            ,0xFFA27900)
+NHSTUB(closedir                               ,0xFFA279D0) // CloseFastDir
+NHSTUB(mkdir                                  ,0xFF826068)
+
+NHSTUB(GetDrive_ClusterSize                   ,0xFF856D08)
+NHSTUB(GetDrive_TotalClusters                 ,0xFF856D3C)
+NHSTUB(GetDrive_FreeClusters                  ,0xFF856DA8)
+
+NHSTUB(LockMainPower                          ,0xFF877D30)
+NHSTUB(UnlockMainPower                        ,0xFF877C8C)
+
+NHSTUB(GetCurrentAvValue                      ,0xFF952D94)
+NHSTUB(MoveFocusLensToDistance                ,0xFFA0D41C)
+NHSTUB(MoveZoomLensWithPoint                  ,0xFF957B34)
+NHSTUB(SetZoomActuatorSpeedPercent            ,0xFF957C70)
+
+NHSTUB(malloc                                 ,0xFF813A2C)
+NHSTUB(free                                   ,0xFF813B00)
+NHSTUB(FreeUncacheableMemory                  ,0xFF82AD08)
+NHSTUB(AllocateUncacheableMemory              ,0xFF82ACD4)
+
+NHSTUB(rand                                   ,0xFF81E76C)
+NHSTUB(srand                                  ,0xFF81BCEC)
+NHSTUB(_log10                                 ,0xFFA92E10)
+NHSTUB(_pow                                   ,0xFFA92F80)
+NHSTUB(_log                                   ,0xFFA93ECC)
+NHSTUB(_sqrt                                  ,0xFFA95234)
+
+NHSTUB(qsort                                  ,0xFF9CA224)
+
+NHSTUB(strstr                                 ,0xFF9C9D44)
+NHSTUB(strncpy                                ,0xFF81E5C0)
+NHSTUB(strrchr                                ,0xFF8B31D8)
+NHSTUB(strncmp                                ,0xFF8B3168)
+NHSTUB(strchr                                 ,0xFF8B31B4)
+NHSTUB(strcat                                 ,0xFF8B312C)
+NHSTUB(strtol                                 ,0xFF831CE4)
+
+NHSTUB(LocalTime                              ,0xFF870604)
+
+NHSTUB(UpdateMBROnFlash                       ,0xFF856AD0)
+
+NHSTUB(UniqueLedOn                            ,0xFF913AF4)
+NHSTUB(UniqueLedOff                           ,0xFF913B7C)
+
+NHSTUB(SetAutoShutdownTime                    ,0xFF877E90)
+
+
+NHSTUB(phySw                                  ,0xFF8235A0)
+NHSTUB(phySw_p1                               ,0xFF8239A4) // called from phySw
+NHSTUB(phySw_p2                               ,0xFF823244) // called when phySw_p1 returns 1
+NHSTUB(NewTaskShell                           ,0xFF874268) // starts new shell on Console. GUI output?
+
+NHSTUB(kbd_read_keys                          ,0xFF8238C8) // Called in kbd.c (originally called from phySw_p1, line 3)
+NHSTUB(kbd_p1_f                               ,0xFF8239A4) // is phySw_p1
+NHSTUB(kbd_p1_f_cont                          ,0xFF8239B0) // after call to kbd_read_keys
+NHSTUB(kbd_p2_f                               ,0xFF823244) // is phySw_p2
+NHSTUB(kbd_read_keys_r2                       ,0xFF84D3E4) // called from kbd_read_keys
+
+
+
+// Possibly useful but not yet necessary
+NHSTUB(GetCCDTemperature                      ,0xFF8504F4) // Unknown units, doesn't really seem to respond
+NHSTUB(GetBatteryTemperature                  ,0xFF850564) // Unknown units, doesn't really seem to respond to frozen batteries
+NHSTUB(GetOpticalTemperature                  ,0xFF8505D4) // Unknown units, doesn't really seem to respond
+NHSTUB(OpenMShutter                           ,0xFFA0BE08)
+NHSTUB(CloseMShutter                          ,0xFFA0BDD0)
+NHSTUB(PutOutNdFilter                         ,0xFFA0BD38) // Doesn't really work on S5, sometimes crashes camera
+NHSTUB(PutInNdFilter                          ,0xFFA0BD00) // Doesn't really work on S5, sometimes crashes camera
+NHSTUB(SSAPI_ExtStrobeCharged                 ,0xFF8287EC) // Functionality unknown. Implied effect implemented in IsStrobeChargeCompleted
+
+
+
+///////////
+// FOLLOWING FUNCTION NOT FOUND, points to nullsub. Function does not exist
+// where it is to be expected according to A720 firmware. Copied it from A720
+// and hooked in boot.c
+//NHSTUB(time, 0xFF81096C)
+
+
+///////////
+// The following functions were not found in the S5 firmware. They do not
+// seem to be required but for some reason someone made this list.
+// Point to nullsub for immediate return
+// nullsub_1: 0xFF81096C (S5)
+NSTUB(CreatePhysicalVram,		 0xFF81096C)
+NSTUB(CreateTaskStrict,			 0xFF81096C)
+NSTUB(DisableDispatch,			 0xFF81096C)
+NSTUB(DisplayImagePhysicalScreen,	 0xFF81096C)
+NSTUB(EnableDispatch,			 0xFF81096C)
+NSTUB(ioctl,					 0xFF81096C)
+NSTUB(iosDevAdd,				 0xFF81096C)
+NSTUB(iosDrvInstall,			 0xFF81096C)
+NSTUB(isalpha,					 0xFF81096C)
+NSTUB(isdigit,					 0xFF81096C)
+NSTUB(islower,					 0xFF81096C)
+NSTUB(isspace,					 0xFF81096C)
+NSTUB(isupper,					 0xFF81096C)
+NSTUB(localtime,				 0xFF81096C)
+NSTUB(MakeDirectory,			 0xFF81096C)
+NSTUB(memPartAlloc,				 0xFF81096C)
+NSTUB(memPartFindMax,			 0xFF81096C)
+NSTUB(Mount_FileSystem,			 0xFF81096C)
+NSTUB(PhySw_testgpio,			 0xFF81096C)
+NSTUB(ProtectFile,				 0xFF81096C)
+NSTUB(readdir,					 0xFF81096C)
+NSTUB(rewinddir,				 0xFF81096C)
+NSTUB(taskCreateHookAdd,			 0xFF81096C)
+NSTUB(taskDeleteHookAdd,			 0xFF81096C)
+NSTUB(taskIdListGet,			 0xFF81096C)
+NSTUB(taskLock,				 0xFF81096C)
+NSTUB(taskName,				 0xFF81096C)
+NSTUB(taskResume,				 0xFF81096C)
+NSTUB(taskSuspend,				 0xFF81096C)
+NSTUB(taskUnlock,				 0xFF81096C)
+NSTUB(utime,					 0xFF81096C)
+NSTUB(Unmount_FileSystem,		 0xFF81096C)
+NSTUB(UIFS_WriteFirmInfoToFile,	 0xFF81096C)
+NSTUB(kbd_pwr_off,				 0xFF81096C) // Does not even exist, I think
+NSTUB(kbd_pwr_on,				 0xFF81096C) // Does not even exist, I think
+NHSTUB(PT_PlaySound, 0xFF86B4DC)
+
+
+
+NHSTUB(EnterToCompensationEVF, 0xff827fa8)
+NHSTUB(ExitFromCompensationEVF, 0xff82809c)
Index: /trunk/platform/s5is/sub/101b/boot.c
===================================================================
--- /trunk/platform/s5is/sub/101b/boot.c	(revision 511)
+++ /trunk/platform/s5is/sub/101b/boot.c	(revision 511)
@@ -0,0 +1,1798 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+const long new_sa = MEMISOSTART + MEMISOSIZE;
+
+/* Our stuff */
+extern long wrs_kernel_bss_start;
+extern long wrs_kernel_bss_end;
+
+// Forward declarations
+void CreateTask_blinker();
+void CreateTask_PhySw();
+void CreateTask_spytask();
+
+void boot();
+void __attribute__((naked,noinline)) task_blinker();
+void dump_chdk();
+
+////////////////////////////////////////////////////////////////////////////////
+// Note to developers:
+// The code below is just somewhat annotated in an attempt to figure out what
+// the camera does. I left it in, it might be of some use to someone someday.
+// Occasionally, I added the .ltorg directive, because the compiler/assembler
+// isn't smart enough to place it somewhere sensible. Remember to bypass
+// (B new_location) that directive if you really *MUST* place it in the middle
+// of your code.
+////////////////////////////////////////////////////////////////////////////////
+
+
+#define DEBUG_LED 0xC02200D4 // Red led (lower-right corner) normally indicating SD read/write
+
+void boot() {
+
+    asm volatile ("B      sub_FF81000C_my\n");
+
+};
+
+
+void __attribute__((naked,noinline)) sub_FF81000C_my() {
+     asm volatile (
+          "LDR     R1, =0xC0400004\n"
+          "LDR     R2, [R1]\n"
+          "ORR     R2, R2, #2\n"
+          "STR     R2, [R1]\n"
+          "LDR     R1, =0xC0410000\n"
+          "MOV     R0, #0\n"
+          "STR     R0, [R1]\n"
+          "MOV     R1, #0x78\n"
+          "MCR     p15, 0, R1,c1,c0\n"
+          "MOV     R1, #0\n"
+          "MCR     p15, 0, R1,c7,c10, 4\n"
+          "MCR     p15, 0, R1,c7,c5\n"
+          "MCR     p15, 0, R1,c7,c6\n"
+          "MOV     R0, #0x3D\n"
+          "MCR     p15, 0, R0,c6,c0\n"
+          "MOV     R0, #0xC000002F\n"
+          "MCR     p15, 0, R0,c6,c1\n"
+          "MOV     R0, #0x33\n"
+          "MCR     p15, 0, R0,c6,c2\n"
+          "LDR     R0, =0x10000033\n"
+          "MCR     p15, 0, R0,c6,c3\n"
+          "MOV     R0, #0x40000017\n"
+          "MCR     p15, 0, R0,c6,c4\n"
+          "LDR     R0, =0xFF80002D\n"
+          "MCR     p15, 0, R0,c6,c5\n"
+          "MOV     R0, #0x34\n"
+          "MCR     p15, 0, R0,c2,c0\n"
+          "MOV     R0, #0x34\n"
+          "MCR     p15, 0, R0,c2,c0, 1\n"
+          "MOV     R0, #0x34\n"
+          "MCR     p15, 0, R0,c3,c0\n"
+          "LDR     R0, =0x3333330\n"
+          "MCR     p15, 0, R0,c5,c0, 2\n"
+          "LDR     R0, =0x3333330\n"
+          "MCR     p15, 0, R0,c5,c0, 3\n"
+          "MRC     p15, 0, R0,c1,c0\n"
+          "ORR     R0, R0, #0x1000\n"
+          "ORR     R0, R0, #4\n"
+          "ORR     R0, R0, #1\n"
+          "MCR     p15, 0, R0,c1,c0\n"
+          "MOV     R1, #0x40000006\n"
+          "MCR     p15, 0, R1,c9,c1\n"
+          "MOV     R1, #6\n"
+          "MCR     p15, 0, R1,c9,c1, 1\n"
+          "MRC     p15, 0, R1,c1,c0\n"
+          "ORR     R1, R1, #0x50000\n"
+          "MCR     p15, 0, R1,c1,c0\n"
+          "LDR     R2, =0xC0200000\n"
+          "MOV     R1, #1\n"
+          "STR     R1, [R2,#0x10C]\n"
+          "MOV     R1, #0xFF\n"
+          "STR     R1, [R2,#0xC]\n"
+          "STR     R1, [R2,#0x1C]\n"
+          "STR     R1, [R2,#0x2C]\n"
+          "STR     R1, [R2,#0x3C]\n"
+          "STR     R1, [R2,#0x4C]\n"
+          "STR     R1, [R2,#0x5C]\n"
+          "STR     R1, [R2,#0x6C]\n"
+          "STR     R1, [R2,#0x7C]\n"
+          "STR     R1, [R2,#0x8C]\n"
+          "STR     R1, [R2,#0x9C]\n"
+          "STR     R1, [R2,#0xAC]\n"
+          "STR     R1, [R2,#0xBC]\n"
+          "STR     R1, [R2,#0xCC]\n"
+          "STR     R1, [R2,#0xDC]\n"
+          "STR     R1, [R2,#0xEC]\n"
+          "STR     R1, [R2,#0xFC]\n"
+          "LDR     R1, =0xC0400008\n"
+          "LDR     R2, =0x430005\n"
+          "STR     R2, [R1]\n"
+          "MOV     R1, #1\n"
+          "LDR     R2, =0xC0243100\n"
+          "STR     R2, [R1]\n"
+          "LDR     R2, =0xC0242010\n"
+          "LDR     R1, [R2]\n"
+          "ORR     R1, R1, #1\n"
+          "STR     R1, [R2]\n"
+          "LDR     R0, =0xFFB07EB8\n"
+          "LDR     R1, =0x1900\n"
+          "LDR     R3, =0x1056C\n"
+
+     "loc_FF81014C:\n"
+          "CMP     R1, R3\n"                     // Copy code from 0xFFB07EB8(inc) onwards to 0x1900(inc) .. 0x1056C (ex)
+          "LDRCC   R2, [R0],#4\n"
+          "STRCC   R2, [R1],#4\n"
+          "BCC     loc_FF81014C\n"               // loop
+          "LDR     R1, =0x9B610\n"
+          "MOV     R2, #0\n"
+
+     "loc_FF810164:\n"
+          "CMP     R3, R1\n"                     // Zerofill from 0x1056C(inc) .. 0x9B610(exc)
+          "STRCC   R2, [R3],#4\n"
+          "BCC     loc_FF810164\n"               // loop
+//          "B       sub_FF8101B8\n"
+          "B       sub_FF8101B8_my\n"            // +---------------------> Hook
+     ".ltorg\n"
+     );
+}
+
+
+void __attribute__((naked,noinline)) sub_FF8101B8_my() {
+     asm volatile (
+     "loc_FF8101B8:\n"
+          "LDR     R0, =0xFF810230\n"
+          "MOV     R1, #0\n"
+          "LDR     R3, =0xFF810268\n"
+
+     "loc_FF8101C4:\n"
+          "CMP     R0, R3\n"                     // Copy code from 0xFF810230(inc) .. 0xFF810268(exc) to 0x0 .. 0x38
+          "LDRCC   R2, [R0],#4\n"
+          "STRCC   R2, [R1],#4\n"
+          "BCC     loc_FF8101C4\n"               // loop
+          "LDR     R0, =0xFF810268\n"
+          "MOV     R1, #0x4B0\n"
+          "LDR     R3, =0xFF81047C\n"
+
+     "loc_FF8101E0:\n"
+          "CMP     R0, R3\n"                     // Copy code from 0xFF810268(inc) .. 0xFF81047C(exc) to 0x4B0 .. 0x6C4
+          "LDRCC   R2, [R0],#4\n"
+          "STRCC   R2, [R1],#4\n"
+          "BCC     loc_FF8101E0\n"               // loop
+          "MOV     R0, #0xD2\n"
+          "MSR     CPSR_cxsf, R0\n"
+          "MOV     SP, #0x1000\n"
+          "MOV     R0, #0xD3\n"
+          "MSR     CPSR_cxsf, R0\n"
+          "MOV     SP, #0x1000\n"
+          "LDR     R0, =0x6C4\n"
+          "LDR     R2, =0xEEEEEEEE\n"
+          "MOV     R3, #0x1000\n"
+
+     "loc_FF810214:\n"
+          "CMP     R0, R3\n"                     // Fill 0x6C4 .. 0x1000 with 0xEEEEEEEE
+          "STRCC   R2, [R0],#4\n"
+          "BCC     loc_FF810214\n"               // loop
+//          "BL      sub_FF810FCC\n"
+          "BL      sub_FF810FCC_my\n"            // +---------------------> Hook
+     ".ltorg\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF810FCC_my() {
+     asm volatile (
+          "STR     LR, [SP,#-0x4]!\n"
+          "SUB     SP, SP, #0x74\n"
+          "MOV     R0, SP\n"
+          "MOV     R1, #0x74\n"
+          "BL      sub_FFA92C10\n"
+          "MOV     R0, #0x53000\n"
+          "STR     R0, [SP,#0x74-0x70]\n"
+//          "LDR     R0, =0x9B610\n"
+          );    
+//          "LDR     R0, =0xDB610\n"			// 0x9B610 + 0x40000 (memsize) = 0xDB610
+          asm volatile (
+             "LDR     R0, =new_sa\n"
+             "LDR     R0, [R0]\n"
+          );
+          asm volatile (
+          "LDR     R2, =0x2ABC00\n"
+          "LDR     R1, =0x2A4968\n"
+          "STR     R0, [SP,#0x74-0x6C]\n"
+          "SUB     R0, R1, R0\n"
+          "ADD     R3, SP, #0x74-0x68\n"
+          "STR     R2, [SP,#0x74-0x74]\n"
+          "STMIA   R3, {R0-R2}\n"
+          "MOV     R0, #0x22\n"
+          "STR     R0, [SP,#0x74-0x5C]\n"
+          "MOV     R0, #0x68\n"
+          "STR     R0, [SP,#0x74-0x58]\n"
+          "LDR     R0, =0x19B\n"
+          "MOV     R1, #0x64\n"
+//          "STRD    R0, [SP,#0x74-0x54]\n"  // WORKSFORME, configure gcc WITHOUT --with-cpu=arm9
+          "STR    R0, [SP,#0x74-0x54]\n"     // Though use the old, 2-line version
+          "STR    R1, [SP,#0x74-0x50]\n"     // for the final until everyone uses 'new' gcc
+          "MOV     R0, #0x78\n"
+//          "STRD    R0, [SP,#0x74-0x4C]\n"  // Idem
+          "STR    R0, [SP,#0x74-0x4C]\n"     // Idem
+          "STR    R1, [SP,#0x74-0x48]\n"     // Idem
+          "MOV     R0, #0\n"
+          "STR     R0, [SP,#0x74-0x44]\n"
+          "STR     R0, [SP,#0x74-0x40]\n"
+          "MOV     R0, #0x10\n"
+          "STR     R0, [SP,#0x74-0x18]\n"
+          "MOV     R0, #0x800\n"
+          "STR     R0, [SP,#0x74-0x14]\n"
+          "MOV     R0, #0xA0\n"
+          "STR     R0, [SP,#0x74-0x10]\n"
+          "MOV     R0, #0x280\n"
+          "STR     R0, [SP,#0x74-0xC]\n"
+//          "LDR     R1, =sub_FF814E0C\n"
+          "LDR     R1, =sub_FF814E0C_my\n"       // +---------------------> Hook
+          "MOV     R0, SP\n"
+          "MOV     R2, #0\n"
+          "BL      sub_FF812D84\n"
+          "ADD     SP, SP, #0x74\n"
+          "LDR     PC, [SP],#4\n"
+     ".ltorg\n"
+     );
+}
+
+
+void __attribute__((naked,noinline)) sub_FF814E0C_my() {
+        asm volatile (
+              "STMFD   SP!, {R4,LR}\n"
+              "BL      sub_FF810970\n"
+              "BL      sub_FF8197D0\n"           // dmSetup
+              "CMP     R0, #0\n"
+//              "ADRLT   R0, aDmsetup\n"
+              "LDRLT   R0, =0xFF814F20\n"
+              "BLLT    sub_FF814F00\n"           // err_init_task
+              "BL      sub_FF814A30\n"           // termDriverInit
+              "CMP     R0, #0\n"
+//              "ADRLT   R0, aTermdriverinit\n" 
+              "LDRLT   R0, =0xFF814F28\n"
+              "BLLT    sub_FF814F00\n"           // err_init_task
+//              "ADR     R0, a_term\n"
+              "LDR     R0, =0xFF814F38\n"
+              "BL      sub_FF814B1C\n"           // termDeviceCreate
+              "CMP     R0, #0\n"
+//              "ADRLT   R0, aTermdevicecrea\n"
+              "LDRLT   R0, =0xFF814F40\n"
+              "BLLT    sub_FF814F00\n"           // err_init_task
+//              "ADR     R0, a_term\n"
+              "LDR     R0, =0xFF814F38\n"
+              "BL      sub_FF813594\n"           // stdioSetup
+              "CMP     R0, #0\n"
+//              "ADRLT   R0, aStdiosetup\n"
+              "LDRLT   R0, =0xFF814F54\n"
+              "BLLT    sub_FF814F00\n"           // err_init_task
+              "BL      sub_FF8194B8\n"           // stdlibSetup
+              "CMP     R0, #0\n"
+//              "ADRLT   R0, aStdlibsetup\n"
+              "LDRLT   R0, =0xFF814F60\n"
+              "BLLT    sub_FF814F00\n"           // err_init_task
+              "BL      sub_FF8114E4\n"           // armlib_setup
+              "CMP     R0, #0\n"
+//              "ADRLT   R0, aArmlib_setup\n"
+              "LDRLT   R0, =0xFF814F6C\n"
+              "BLLT    sub_FF814F00\n"           // err_init_task
+              "LDMFD   SP!, {R4,LR}\n"
+              //"B       sub_FF81D9F0\n"         // CreateTaskStartup
+              "B       sub_FF81D9F0_my\n"        // +---------------------> Hook
+     ".ltorg\n"
+        );
+};
+
+
+void __attribute__((naked,noinline)) sub_FF81D9F0_my() {
+     asm volatile (
+          "STMFD   SP!, {R3,LR}\n"
+          "BL      sub_FF82CE28\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF81DA2C\n"
+          "BL      sub_FF824D04\n"
+          "CMP     R0, #0\n"
+          "LDREQ   R2, =0xC0220000\n"
+          "LDREQ   R0, [R2,#0x10C]\n"
+          "LDREQ   R1, [R2,#0x108]\n"
+          "ORREQ   R0, R0, R1\n"
+          "TSTEQ   R0, #1\n"
+          "BNE     loc_FF81DA2C\n"
+          "MOV     R0, #0x44\n"
+          "STR     R0, [R2,#0x4C]\n"
+
+     "loc_FF81DA28:\n"
+          "B       loc_FF81DA28\n"
+
+
+     "loc_FF81DA2C:\n"
+          "BL      sub_FF823630\n"
+          "BL      sub_FF82A9D0\n"
+          "MOV     R1, #0x300000\n"
+          "MOV     R0, #0\n"
+          "BL      sub_FF82AC18\n"
+          "BL      sub_FF82ABC4\n"
+          "MOV     R3, #0\n"
+          "STR     R3, [SP,#8-8]\n"
+//          "LDR     R3, sub_FF81D950\n"         // Startup, 0xFF81D950
+          "LDR     R3, =sub_FF81D950_my\n"       // +---------------------> Hook
+          "MOV     R2, #0\n"
+          "MOV     R1, #0x19\n"
+//          "ADR     R0, aStartup\n"
+          "LDR     R0, =0xFF81DA7C\n"
+          "BL      sub_FF81B8FC\n"               // CreateTask
+          "MOV     R0, #0\n"
+          "LDMFD   SP!, {R12,PC}\n"
+     ".ltorg\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF81D950_my() {
+     asm volatile (
+          "STMFD   SP!, {R4,LR}\n"
+          "BL      sub_FF8151CC\n"
+          "BL      sub_FF824778\n"
+          "BL      sub_FF820D4C\n"
+          //"BL      j_nullsub_163\n"            
+          "BL      sub_FF82D018\n"
+//          "BL      sub_FF82CF00\n"            // Apparently responsible for
+                                                // diskboot. Bypassing it does
+                                                // not seem to affect the camera
+                                                // negatively.
+     );
+     
+     CreateTask_spytask();
+     
+     asm volatile (
+          "LDR     R4, =0x66A8\n"
+          "B       loc_FF81D97C\n"
+
+     "loc_FF81D974:\n"
+          "SUBS    R4, R4, #1\n"
+          "BEQ     loc_FF81D98C\n"
+
+     "loc_FF81D97C:\n"
+          "MOV     R0, #5\n"
+          "BL      sub_FF820E54\n"
+          "CMP     R0, #1\n"
+          "BEQ     loc_FF81D974\n"
+
+     "loc_FF81D98C:\n"
+          "MOV     R0, #5\n"
+          "BL      sub_FF82124C\n"
+          "SUBS    R12, R0, #0x300\n"
+          "SUBGES  R12, R12, #0xF6\n"
+          "BLE     loc_FF81D9B0\n"
+          "BL      sub_FF829F0C\n"
+          "MOV     R1, #0xB5\n"
+//          "ADR     R0, aStartup_c\n"
+          "LDR     R0, =0xFF81DA6C\n"
+          "BL      sub_FF81BCCC\n"               // Assert, 0xFF81BCCC
+
+     "loc_FF81D9B0:\n"
+          "BL      sub_FF82DABC\n"
+          "BL      sub_FF82D068\n"
+          "BL      sub_FF829F0C\n"
+          "BL      sub_FF82DACC\n"
+          //"BL      sub_FF8235D4\n"             // PhySw, bypass and create own
+     );
+
+     CreateTask_PhySw();
+
+     asm volatile (
+//          "BL      sub_FF826988\n"             // CaptSeqTask and lots of other stuff
+          "BL      sub_FF826988_my\n"            // +---------------------> Hook (in capt_seq.c)
+          "BL      sub_FF82DAEC\n"
+          //"BL      nullsub_2\n"
+          "BL      sub_FF822998\n"
+          "BL      sub_FF82CBF4\n"
+          "BL      sub_FF8230C0\n"
+          "BL      sub_FF8228A4\n"
+          //"BL      sub_FF82E570\n"
+          "BL      sub_FF82E570_my\n"            // +---> MAJOR HOOK (SDHC boot)
+          "BL      sub_FF822728\n"
+          "LDMFD   SP!, {R4,LR}\n"
+          "B       sub_FF8150D8\n"
+     ".ltorg\n"
+     );
+}
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+// Major SDHC boot fix hook starts here
+//
+// Paths that certainly do not (by itself) get the SDHC booting going:
+// sub_FF82E570 -> sub_FF824D18 -> sub_FF824A60 -> sub_FF87BF78 (entire 'right subtree')
+// sub_FF82E570 -> sub_FF82E120 -> sub_FF87AC88 -> sub_FF87A340 -> sub_FF87BF78 (shortest path (subroutine-count-wise) through 'left subtree')
+// sub_FF82E570 -> sub_FF82E120 -> sub_FF87AC88 -> sub_FF87A80C -> sub_FF87A340 -> sub_FF87BF78 (sub_FF87A80C does not appear to be called)
+// 
+// Unexplored:
+// sub_FF82E570 -> sub_FF82E120 -> sub_FF87BD48 -> sub_FF87BB94 -> sub_FF87AC88 ->              -> sub_FF87A340 -> sub_FF87BF78
+//                                                                              -> sub_FF87A80C ->
+//
+// Final, working path:
+// sub_FF82E570 -> sub_FF82E120 -> sub_FF87BD48 -> sub_FF87BB94 -> sub_FF87AC88 -> sub_FF87A340 -> sub_FF87BF78
+//
+// That's the 'tree'-part, the rest of the subroutines are just straight on down, no junctions.
+// -> sub_FF87BF28 -> sub_FF874FDC -> sub_FF856910 -> sub_FF85674C -> sub_FF8565E4
+/////////////////////////////////////////////////////////////////////////////////////
+
+void __attribute__((naked,noinline)) sub_FF82E570_my() {
+     asm volatile (
+          "STMFD   SP!, {R4,LR}\n"
+          "BL      sub_FF878D88\n"
+          "BL      sub_FF824CD8\n"
+          "CMP     R0, #1\n"
+          "BNE     loc_FF82E590\n"
+          "BL      sub_FF87C08C\n"
+          "LDMFD   SP!, {R4,LR}\n"
+          "B       sub_FF824D18\n"
+
+     "loc_FF82E590:\n"
+          "BL      sub_FF87AF30\n"
+          "LDR     R4, =0x1E80\n"
+          "LDR     R0, [R4,#4]\n"
+          "CMP     R0, #0\n"
+          "LDMNEFD SP!, {R4,PC}\n"
+          "MOV     R1, #0\n"
+          //"LDR     R0, =0xFF82E120\n"
+          "LDR     R0, =sub_FF82E120_my\n"       // +----> Hook for SDHC booting
+          "BL      sub_FF875938\n"
+          "STR     R0, [R4,#4]\n"
+          "LDMFD   SP!, {R4,PC}\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF82E120_my() {
+     asm volatile (
+          "STMFD   SP!, {R3-R11,LR}\n"
+          "LDR     R6, =0x1E80\n"
+          "MOV     R5, R1\n"
+          "LDR     R0, [R6,#0x14]\n"
+          "MOV     R4, R3\n"
+          "CMP     R0, #1\n"
+          "BNE     loc_FF82E144\n"
+          "BL      sub_FF8795E0\n"
+          "B       loc_FF82E1C8\n"
+
+     "loc_FF82E144:\n"
+          "LDR     R12, =0x1162\n"
+          "LDR     R10, =0x1005\n"
+          "CMP     R5, R12\n"
+          "MOV     R7, #0\n"
+          "MOV     R8, #1\n"
+          "BEQ     loc_FF82E4C4\n"
+          "BGT     loc_FF82E28C\n"
+          "LDR     R12, =0x1062\n"
+          "CMP     R5, R12\n"
+          "BEQ     loc_FF82E54C\n"
+          "BGT     loc_FF82E1F8\n"
+          "CMP     R5, R10\n"
+          "BEQ     loc_FF82E248\n"
+          "BGT     loc_FF82E1D0\n"
+          "SUB     R12, R5, #0x800\n"
+          "SUBS    R12, R12, #3\n"
+          "BEQ     loc_FF82E3CC\n"
+          "SUB     R12, R5, #0x800\n"
+          "SUBS    R12, R12, #0x158\n"
+          "BEQ     loc_FF82E554\n"
+          "LDR     R4, =0x9A3\n"
+          "CMP     R5, R4\n"
+          "ADD     R7, R4, #2\n"
+          "CMPNE   R5, R7\n"
+          "BNE     loc_FF82E4B4\n"
+          "LDR     R0, [R6,#0xC]\n"
+          "SUB     R12, R0, #0x8000\n"
+          "SUBS    R12, R12, #2\n"
+          "BEQ     loc_FF82E1C8\n"
+          "LDR     R0, =0x10A5\n"
+          "BL      sub_FF877A7C\n"
+          "CMP     R0, #0\n"
+          "BEQ     loc_FF82E4A0\n"
+
+     "loc_FF82E1C8:\n"
+          "MOV     R0, #0\n"
+          "LDMFD   SP!, {R3-R11,PC}\n"
+
+     "loc_FF82E1D0:\n"
+          "SUB     R12, R5, #0x1000\n"
+          "SUBS    R12, R12, #0x56\n"
+          "SUBNE   R12, R5, #0x1000\n"
+          "SUBNES  R12, R12, #0x5B\n"
+          "SUBNE   R12, R5, #0x1000\n"
+          "SUBNES  R12, R12, #0x5E\n"
+          "SUBNE   R12, R5, #0x1000\n"
+          "SUBNES  R12, R12, #0x61\n"
+          "BNE     loc_FF82E4B4\n"
+          "B       loc_FF82E54C\n"
+
+     "loc_FF82E1F8:\n"
+          "LDR     R12, =0x10AD\n"
+          "CMP     R5, R12\n"
+          "BEQ     loc_FF82E4EC\n"
+          "BGT     loc_FF82E250\n"
+          "SUB     R12, R5, #0x1000\n"
+          "SUBS    R12, R12, #0x63\n"
+          "SUBNE   R12, R5, #0x1000\n"
+          "SUBNES  R12, R12, #0x65\n"
+          "BEQ     loc_FF82E54C\n"
+          "SUB     R12, R5, #0x1000\n"
+          "LDR     R0, =0x10A3\n"
+          "SUBS    R12, R12, #0xA9\n"
+          "BEQ     loc_FF82E4E0\n"
+          "SUB     R12, R5, #0x1000\n"
+          "SUBS    R12, R12, #0xAA\n"
+          "BNE     loc_FF82E4B4\n"
+          "BL      sub_FF877A7C\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF82E1C8\n"
+
+     "loc_FF82E244:\n"
+          "BL      sub_FF82EB04\n"
+
+     "loc_FF82E248:\n"
+          "MOV     R1, R4\n"
+          "B       loc_FF82E4B8\n"
+
+     "loc_FF82E250:\n"
+          "SUB     R12, R5, #0x1000\n"
+          "SUBS    R12, R12, #0xAE\n"
+          "BEQ     loc_FF82E244\n"
+          "SUB     R12, R5, #0x1000\n"
+          "SUBS    R12, R12, #0xAF\n"
+          "BEQ     loc_FF82E4EC\n"
+          "SUB     R12, R5, #0x1000\n"
+          "SUBS    R12, R12, #0xB0\n"
+          "BEQ     loc_FF82E244\n"
+          "SUB     R12, R5, #0x1000\n"
+          "SUBS    R12, R12, #0xB2\n"
+          "BNE     loc_FF82E4B4\n"
+          "LDR     R0, =0x1008\n"
+          "MOV     R1, R4\n"
+          "B       loc_FF82E4BC\n"
+
+     "loc_FF82E28C:\n"
+          "LDR     R11, =0x201B\n"
+          "LDR     R0, =0x1E80\n"
+          "CMP     R5, R11\n"
+          "LDR     R2, [R0,#0x10]!\n"
+          "LDR     R1, [R0,#0x10]\n"
+          "SUB     R9, R11, #0x17\n"
+          "BEQ     loc_FF82E480\n"
+          "BGT     loc_FF82E354\n"
+          "LDR     R11, =0x116A\n"
+          "CMP     R5, R11\n"
+          "BEQ     loc_FF82E46C\n"
+          "BGT     loc_FF82E308\n"
+          "SUB     R12, R5, #0x1100\n"
+          "SUBS    R12, R12, #0x63\n"
+          "MOVEQ   R1, #0\n"
+          "MOVEQ   R0, #0x82\n"
+          "BEQ     loc_FF82E498\n"
+          "SUB     R12, R5, #0x1100\n"
+          "SUBS    R12, R12, #0x65\n"
+          "BEQ     loc_FF82E490\n"
+          "LDR     R4, =0x1168\n"
+          "SUB     R12, R5, #0x1100\n"
+          "SUBS    R12, R12, #0x67\n"
+          "CMPNE   R5, R4\n"
+          "BNE     loc_FF82E4B4\n"
+          "STR     R8, [R6,#0x10]\n"
+          "LDR     R6, =0x4508\n"
+          "CMP     R1, #0\n"
+          "BEQ     loc_FF82E45C\n"
+          "BL      sub_FF879614\n"
+          "B       loc_FF82E460\n"
+
+     "loc_FF82E308:\n"
+          "SUB     R12, R5, #0x2000\n"
+          "SUBS    R12, R12, #2\n"
+          "BEQ     loc_FF82E518\n"
+          "CMP     R5, R9\n"
+          "MOV     R0, R9\n"
+          "BEQ     loc_FF82E524\n"
+          "SUB     R12, R5, #0x2000\n"
+          "SUBS    R12, R12, #5\n"
+          "BEQ     loc_FF82E518\n"
+          "SUB     R12, R5, #0x2000\n"
+          "SUBS    R12, R12, #0x19\n"
+          "BNE     loc_FF82E4B4\n"
+          "CMP     R1, #0\n"
+          "BEQ     loc_FF82E1C8\n"
+          "CMP     R2, #0\n"
+          "BNE     loc_FF82E1C8\n"
+
+     "loc_FF82E348:\n"
+          "MOV     R1, #0\n"
+
+     "loc_FF82E34C:\n"
+          "BL      sub_FF87AC88\n"
+          "B       loc_FF82E1C8\n"
+
+     "loc_FF82E354:\n"
+          "LDR     R12, =0x3110\n"
+          "CMP     R5, R12\n"
+          "BEQ     loc_FF82E248\n"
+          "BGT     loc_FF82E39C\n"
+          "SUB     R12, R5, #0x2000\n"
+          "SUBS    R12, R12, #0x1D\n"
+          "BEQ     loc_FF82E518\n"
+          "LDR     R0, =0x2027\n"
+          "CMP     R5, R0\n"
+          "BEQ     loc_FF82E4F8\n"
+          "SUB     R12, R5, #0x3000\n"
+          "SUBS    R12, R12, #6\n"
+          "BEQ     loc_FF82E248\n"
+          "SUB     R12, R5, #0x3000\n"
+          "SUBS    R12, R12, #0x10\n"
+          "BNE     loc_FF82E4B4\n"
+          "BL      sub_FF89A628\n"
+          "B       loc_FF82E1C8\n"
+
+     "loc_FF82E39C:\n"
+          "SUB     R12, R5, #0x3100\n"
+          "SUBS    R12, R12, #0x11\n"
+          "BEQ     loc_FF82E248\n"
+          "CMP     R5, #0x3140\n"
+          "BEQ     loc_FF82E540\n"
+          "SUB     R12, R5, #0x3200\n"
+          "SUBS    R12, R12, #1\n"
+          "BEQ     loc_FF82E4B4\n"
+          "SUB     R12, R5, #0x3200\n"
+          "SUBS    R12, R12, #2\n"
+          "BEQ     loc_FF82E248\n"
+          "B       loc_FF82E4B4\n"
+
+     "loc_FF82E3CC:\n"
+          "MOV     R4, #1\n"
+          "MOV     R0, #2\n"
+          "BL      sub_FF878E1C\n"
+          "CMP     R0, #1\n"
+          "MOVEQ   R4, #2\n"
+          "MOV     R0, R4\n"
+          "BL      sub_FF822CC4\n"
+          "CMP     R0, #0\n"
+          "STRNE   R8, [R6,#0x14]\n"
+          "BNE     loc_FF82E428\n"
+          "BL      sub_FF87F814\n"
+          "BL      sub_FF87CD38\n"
+          "BL      sub_FF87DBD8\n"
+          "BL      sub_FF87E0E8\n"
+          "BL      sub_FF87C310\n"
+          "BL      sub_FF87E4E4\n"
+          "CMP     R0, #0\n"
+          "BEQ     loc_FF82E430\n"
+          "BL      sub_FF82DE8C\n"
+          "BL      sub_FF87E4D8\n"
+          "MOV     R1, R0\n"
+          "LDR     R0, =0x1167\n"
+          "BL      sub_FF876100\n"
+
+     "loc_FF82E428:\n"
+          "MOV     R0, R7\n"
+          "LDMFD   SP!, {R3-R11,PC}\n"
+
+     "loc_FF82E430:\n"
+          "BL      sub_FF826FA0\n"
+          "CMP     R0, #1\n"
+          "LDRNE   R0, =0x310B\n"
+          "LDREQ   R0, =0x310C\n"
+          "MOV     R1, #0\n"
+          "BL      sub_FF876100\n"
+          //"BL      sub_FF87BD48\n"
+          "BL      sub_FF87BD48_my\n"            // +----> Hook for SDHC booting
+          "B       loc_FF82E428\n"
+
+     "loc_FF82E450:\n"
+          "MOV     R0, R6\n"
+          "BL      sub_FF8641A8\n"
+          "B       loc_FF82E1C8\n"
+
+     "loc_FF82E45C:\n"
+          "BL      sub_FF826C98\n"
+
+     "loc_FF82E460:\n"
+          "CMP     R5, R4\n"
+          "BNE     loc_FF82E1C8\n"
+          "B       loc_FF82E450\n"
+
+     "loc_FF82E46C:\n"
+          "MOV     R0, #1\n"
+          "BL      sub_FF87972C\n"
+          "MOV     R1, R11\n"
+          "MOV     R0, R10\n"
+          "B       loc_FF82E4BC\n"
+
+     "loc_FF82E480:\n"
+          "CMP     R2, #1\n"
+          "BNE     loc_FF82E248\n"
+          "BL      sub_FF879614\n"
+          "B       loc_FF82E1C8\n"
+
+     "loc_FF82E490:\n"
+          "MOV     R1, #0\n"
+          "MOV     R0, #0x83\n"
+
+     "loc_FF82E498:\n"
+          "BL      sub_FF87E1BC\n"
+          "B       loc_FF82E1C8\n"
+
+     "loc_FF82E4A0:\n"
+          "CMP     R5, R4\n"
+          "STREQ   R8, [R6,#0x34]\n"
+          "BEQ     loc_FF82E4B4\n"
+          "CMP     R5, R7\n"
+          "STREQ   R8, [R6,#0x30]\n"
+
+     "loc_FF82E4B4:\n"
+          "MOV     R1, #0\n"
+
+     "loc_FF82E4B8:\n"
+          "MOV     R0, R5\n"
+
+     "loc_FF82E4BC:\n"
+          "BL      sub_FF87AC88\n"
+          "LDMFD   SP!, {R3-R11,PC}\n"
+
+     "loc_FF82E4C4:\n"
+          "BL      sub_FF882260\n"
+          "CMP     R0, #0\n"
+          "BEQ     loc_FF82E248\n"
+          "BL      sub_FF882B70\n"
+          "CMP     R0, #0\n"
+          "BLEQ    sub_FF880F94\n"
+          "B       loc_FF82E248\n"
+
+     "loc_FF82E4E0:\n"
+          "BL      sub_FF877A7C\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF82E1C8\n"
+
+     "loc_FF82E4EC:\n"
+          "MOV     R0, R5\n"
+          "BL      sub_FF82DFAC\n"
+          "LDMFD   SP!, {R3-R11,PC}\n"
+
+     "loc_FF82E4F8:\n"
+          "MOV     R1, #0\n"
+          "BL      sub_FF87AC88\n"
+          "MOV     R1, #0\n"
+          "MOV     R0, R11\n"
+          "BL      sub_FF87AC88\n"
+          "MOV     R1, #0\n"
+          "MOV     R0, R9\n"
+          "B       loc_FF82E34C\n"
+
+     "loc_FF82E518:\n"
+          "STR     R7, [R6,#0x20]\n"
+          "BL      sub_FF82E7A4\n"
+          "B       loc_FF82E248\n"
+
+     "loc_FF82E524:\n"
+          "STR     R7, [R6,#0x20]\n"
+          "BL      sub_FF82E7A4\n"
+          "LDR     R0, [R6,#0x10]\n"
+          "CMP     R0, #1\n"
+          "BNE     loc_FF82E248\n"
+          "BL      sub_FF879640\n"
+          "B       loc_FF82E1C8\n"
+
+     "loc_FF82E540:\n"
+          "CMP     R1, #0\n"
+          "BLEQ    sub_FF82E7A4\n"
+          "B       loc_FF82E1C8\n"
+
+     "loc_FF82E54C:\n"
+          "MVN     R0, #0\n"
+          "B       loc_FF82E348\n"
+
+     "loc_FF82E554:\n"
+          "TST     R4, #0x80000000\n"
+          "MOVNE   R0, #1\n"
+          "LDMNEFD SP!, {R3-R11,PC}\n"
+          "BL      sub_FF883D08\n"
+          "CMP     R0, #0\n"
+          "BLEQ    sub_FF829CD8\n"
+          "B       loc_FF82E1C8\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF87BD48_my() {
+     asm volatile (
+          "STMFD   SP!, {R4,LR}\n"
+          "BL      sub_FF82E770\n"
+          "MOV     R4, R0\n"
+          "BL      sub_FF87BE64\n"
+          "MOV     R0, R4\n"
+          "BL      sub_FF87BBF8\n"
+          "BL      sub_FF82E770\n"
+          "MOV     R4, R0\n"
+          "LDR     R0, =0x6374\n"
+          "LDR     R0, [R0]\n"
+          "TST     R0, #1\n"
+          "BEQ     loc_FF87BD84\n"
+
+     "loc_FF87BD78:\n"
+          "MOV     R1, R4\n"
+          "MOV     R0, #2\n"
+          "B       loc_FF87BDEC\n"
+
+     "loc_FF87BD84:\n"
+          "TST     R0, #0x2000\n"
+          "BEQ     loc_FF87BDA0\n"
+          "TST     R0, #0x200\n"
+          "LDREQ   R1, =0x4004\n"
+          "LDRNE   R1, =0x8002\n"
+          "MOV     R0, #3\n"
+          "B       loc_FF87BDEC\n"
+
+     "loc_FF87BDA0:\n"
+          "TST     R0, #0x10\n"
+          "BNE     loc_FF87BD78\n"
+          "TST     R0, #0x40\n"
+          "BEQ     loc_FF87BDBC\n"
+
+     "loc_FF87BDB0:\n"
+          "MOV     R1, R4\n"
+          "MOV     R0, #1\n"
+          "B       loc_FF87BDEC\n"
+
+     "loc_FF87BDBC:\n"
+          "TST     R0, #0x20\n"
+          "BEQ     loc_FF87BDD8\n"
+          "TST     R0, #0x4000\n"
+          "BNE     loc_FF87BDD8\n"
+
+     "loc_FF87BDCC:\n"
+          "MOV     R1, R4\n"
+          "MOV     R0, #0\n"
+          "B       loc_FF87BDEC\n"
+
+     "loc_FF87BDD8:\n"
+          "LDR     R1, =0x102\n"
+          "BICS    R1, R1, R0\n"
+          "BNE     loc_FF87BDF4\n"
+          "MOV     R1, R4\n"
+          "MOV     R0, #6\n"
+
+     "loc_FF87BDEC:\n"
+          "LDMFD   SP!, {R4,LR}\n"
+          //"B       sub_FF87BB94\n"
+          "B       sub_FF87BB94_my\n"            // +----> Hook for SDHC booting
+
+     "loc_FF87BDF4:\n"
+          "TST     R0, #0x100\n"
+          "BNE     loc_FF87BD78\n"
+          "TST     R0, #0x4000\n"
+          "TSTEQ   R0, #0x400\n"
+          "BNE     loc_FF87BDB0\n"
+          "TST     R0, #0x200\n"
+          "TSTEQ   R0, #2\n"
+          "BNE     loc_FF87BDCC\n"
+          "TST     R0, #0x40000\n"
+          "BEQ     loc_FF87BD78\n"
+          "TST     R0, #0x200000\n"
+          "MOVEQ   R1, R4\n"
+          "MOVEQ   R0, #1\n"
+          //"BLEQ    sub_FF87BB94\n"
+          "BLEQ    sub_FF87BB94_my\n"            // +----> Hook for SDHC booting
+          "B       loc_FF87BD78\n"
+     );
+}
+
+
+void __attribute__((naked,noinline)) sub_FF87BB94_my() {
+     asm volatile (
+          "STMFD   SP!, {R4-R6,LR}\n"
+          "MOVS    R4, R0\n"
+          "MOV     R0, #1\n"
+          "MOV     R5, R1\n"
+          "BNE     loc_FF87BBD4\n"
+          "MOV     R1, #0\n"
+          "MOV     R0, #0\n"
+          "BL      sub_FF878DAC\n"
+          "BL      sub_FF82E770\n"
+          "SUB     R12, R0, #0x1000\n"
+          "SUBS    R12, R12, #0x5B\n"
+          "BNE     loc_FF87BBCC\n"
+
+     "loc_FF87BBC4:\n"
+          "BL      sub_FF87BADC\n"
+          "B       loc_FF87BBDC\n"
+
+     "loc_FF87BBCC:\n"
+          "BL      sub_FF87BB1C\n"
+          "B       loc_FF87BBDC\n"
+
+     "loc_FF87BBD4:\n"
+          "CMP     R4, #5\n"
+          "BEQ     loc_FF87BBC4\n"
+
+     "loc_FF87BBDC:\n"
+          "CMP     R0, #0\n"
+          "LDREQ   R5, =0x1162\n"
+          "MOVEQ   R4, #2\n"
+          "MOV     R0, R4\n"
+          "MOV     R1, R5\n"
+          "LDMFD   SP!, {R4-R6,LR}\n"
+          //"B       sub_FF87AC88\n"
+          "B       sub_FF87AC88_my\n"            // +----> Hook for SDHC booting
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF87AC88_my() {
+     asm volatile (
+          "STMFD   SP!, {R4-R8,LR}\n"
+          "MOV     R8, R1\n"
+          "MOV     R4, R0\n"
+          "BL      sub_FF879928\n"
+          "LDR     R5, =0x62AC\n"
+          "MOV     R7, #1\n"
+          "LDR     R0, [R5,#0x10]\n"
+          "MOV     R6, #0\n"
+          "CMP     R0, #0x15\n"
+          "ADDLS   PC, PC, R0,LSL#2\n"
+          "B       loc_FF87AF28\n"
+
+     "loc_FF87ACB4:\n"
+          "B       loc_FF87AD0C\n"
+
+     "loc_FF87ACB8:\n"
+          "B       loc_FF87AD34\n"
+
+     "loc_FF87ACBC:\n"
+          "B       loc_FF87AD78\n"
+
+     "loc_FF87ACC0:\n"
+          "B       loc_FF87ADEC\n"
+
+     "loc_FF87ACC4:\n"
+          "B       loc_FF87ADFC\n"
+
+     "loc_FF87ACC8:\n"
+          "B       loc_FF87AE08\n"
+
+     "loc_FF87ACCC:\n"
+          "B       loc_FF87AE78\n"
+
+     "loc_FF87ACD0:\n"
+          "B       loc_FF87AE88\n"
+
+     "loc_FF87ACD4:\n"
+          "B       loc_FF87AD1C\n"
+
+     "loc_FF87ACD8:\n"
+          "B       loc_FF87AD28\n"
+
+     "loc_FF87ACDC:\n"
+          "B       loc_FF87AE88\n"
+
+     "loc_FF87ACE0:\n"
+          "B       loc_FF87AD6C\n"
+
+     "loc_FF87ACE4:\n"
+          "B       loc_FF87AF28\n"
+
+     "loc_FF87ACE8:\n"
+          "B       loc_FF87AF28\n"
+
+     "loc_FF87ACEC:\n"
+          "B       loc_FF87AD84\n"
+
+     "loc_FF87ACF0:\n"
+          "B       loc_FF87AD90\n"
+
+     "loc_FF87ACF4:\n"
+          "B       loc_FF87ADC4\n"
+
+     "loc_FF87ACF8:\n"
+          "B       loc_FF87AD40\n"
+
+     "loc_FF87ACFC:\n"
+          "B       loc_FF87AF10\n"
+
+     "loc_FF87AD00:\n"
+          "B       loc_FF87AE94\n"
+
+     "loc_FF87AD04:\n"
+          "B       loc_FF87AEC4\n"
+
+     "loc_FF87AD08:\n"
+          "B       loc_FF87AEC4\n"
+
+     "loc_FF87AD0C:\n"
+          "MOV     R1, R8\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          //"B       sub_FF87A340\n"
+          "B       sub_FF87A340_my\n"            // +----> Hook for SDHC booting
+
+     "loc_FF87AD1C:\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          "B       sub_FF87B658\n"
+
+     "loc_FF87AD28:\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          "B       sub_FF87A80C\n"
+
+     "loc_FF87AD34:\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          "B       sub_FF879F08\n"
+
+     "loc_FF87AD40:\n"
+          "SUB     R12, R4, #0x1000\n"
+          "SUBS    R12, R12, #0xA5\n"
+          "STREQ   R7, [R5,#0x84]\n"
+          "BEQ     loc_FF87AF20\n"
+          "SUB     R12, R4, #0x3000\n"
+          "SUBS    R12, R12, #6\n"
+          "BNE     loc_FF87AF28\n"
+          "MOV     R0, #0\n"
+          "BL      sub_FF82DCE4\n"
+          "BL      sub_FF87B57C\n"
+          "B       loc_FF87AF20\n"
+
+     "loc_FF87AD6C:\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          "B       sub_FF87B5B8\n"
+
+     "loc_FF87AD78:\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          "B       sub_FF87A104\n"
+
+     "loc_FF87AD84:\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          "B       sub_FF87A9B8\n"
+
+     "loc_FF87AD90:\n"
+          "SUB     R12, R4, #0x3200\n"
+          "SUBS    R12, R12, #2\n"
+          "BNE     loc_FF87AF28\n"
+          "MOV     R0, #3\n"
+          "BL      sub_FF87980C\n"
+          "MOV     R0, #8\n"
+          "BL      sub_FF82DC50\n"
+          "MOV     R0, #6\n"
+          "BL      sub_FF84239C\n"
+          "BL      sub_FF87D148\n"
+          "BL      sub_FF87CFA4\n"
+          "BL      sub_FF87C380\n"
+          "B       loc_FF87AF20\n"
+
+     "loc_FF87ADC4:\n"
+          "SUB     R12, R4, #0x3300\n"
+          "SUBS    R12, R12, #1\n"
+          "BNE     loc_FF87AF28\n"
+          "LDR     R0, =0x4010\n"
+          "BL      sub_FF82DC50\n"
+          "BL      sub_FF89EF88\n"
+          "BL      sub_FF87C380\n"
+          "MOV     R0, #4\n"
+          "BL      sub_FF87980C\n"
+          "B       loc_FF87AF20\n"
+
+     "loc_FF87ADEC:\n"
+          "MOV     R1, R8\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          "B       sub_FF87AB20\n"
+
+     "loc_FF87ADFC:\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          "B       sub_FF87B788\n"
+
+     "loc_FF87AE08:\n"
+          "LDR     R8, =0x1182\n"
+          "CMP     R4, R8\n"
+          "STREQ   R7, [R5,#0xB0]\n"
+          "BEQ     loc_FF87AF20\n"
+          "SUB     R12, R4, #0x1100\n"
+          "SUBS    R12, R12, #0x86\n"
+          "BEQ     loc_FF87AE60\n"
+          "SUB     R12, R4, #0x3200\n"
+          "SUBS    R12, R12, #0x16\n"
+          "BNE     loc_FF87AF28\n"
+          "MOV     R0, #8\n"
+          "BL      sub_FF82DC50\n"
+          "MOV     R0, #3\n"
+          "BL      sub_FF87980C\n"
+          "STR     R6, [R5,#0xB4]\n"
+          "LDR     R0, [R5,#0xB0]\n"
+          "CMP     R0, #0\n"
+          "MOVNE   R1, #0\n"
+          "MOVNE   R0, R8\n"
+          "STRNE   R6, [R5,#0xB0]\n"
+          "BLNE    sub_FF87AB20\n"
+          "B       loc_FF87AF20\n"
+
+     "loc_FF87AE60:\n"
+          "LDR     R0, [R5,#0xB4]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF87AF20\n"
+          "BL      sub_FF89C658\n"
+          "STR     R7, [R5,#0xB4]\n"
+          "B       loc_FF87AF20\n"
+
+     "loc_FF87AE78:\n"
+          "MOV     R1, R8\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          "B       sub_FF87B868\n"
+
+     "loc_FF87AE88:\n"
+          "MOV     R0, R4\n"
+          "LDMFD   SP!, {R4-R8,LR}\n"
+          "B       sub_FF87A704\n"
+
+     "loc_FF87AE94:\n"
+          "LDR     R12, =0x10B0\n"
+          "CMP     R4, R12\n"
+          "BEQ     loc_FF87AEC0\n"
+          "BGT     loc_FF87AECC\n"
+          "CMP     R4, #4\n"
+          "BEQ     loc_FF87AEF4\n"
+          "SUB     R12, R4, #0x1000\n"
+          "SUBS    R12, R12, #0xAA\n"
+          "SUBNE   R12, R4, #0x1000\n"
+          "SUBNES  R12, R12, #0xAE\n"
+          "BNE     loc_FF87AF28\n"
+
+     "loc_FF87AEC0:\n"
+          "BL      sub_FF879508\n"
+
+     "loc_FF87AEC4:\n"
+          "MOV     R0, R6\n"
+          "LDMFD   SP!, {R4-R8,PC}\n"
+
+     "loc_FF87AECC:\n"
+          "SUB     R12, R4, #0x2000\n"
+          "SUBS    R12, R12, #4\n"
+          "BEQ     loc_FF87AF08\n"
+          "SUB     R12, R4, #0x5000\n"
+          "SUBS    R12, R12, #1\n"
+          "SUBNE   R12, R4, #0x5000\n"
+          "SUBNES  R12, R12, #6\n"
+          "BNE     loc_FF87AF28\n"
+          "BL      sub_FF879EA8\n"
+          "B       loc_FF87AF20\n"
+
+     "loc_FF87AEF4:\n"
+          "LDR     R0, [R5,#0x2C]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF87AF08\n"
+          "BL      sub_FF826C50\n"
+          "B       loc_FF87AF20\n"
+
+     "loc_FF87AF08:\n"
+          "BL      sub_FF879540\n"
+          "B       loc_FF87AF20\n"
+
+     "loc_FF87AF10:\n"
+          "SUB     R12, R4, #0x3000\n"
+          "SUBS    R12, R12, #0x130\n"
+          "BNE     loc_FF87AF28\n"
+          "BL      sub_FF8795E0\n"
+
+     "loc_FF87AF20:\n"
+          "MOV     R0, #0\n"
+          "LDMFD   SP!, {R4-R8,PC}\n"
+
+     "loc_FF87AF28:\n"
+          "MOV     R0, #1\n"
+          "LDMFD   SP!, {R4-R8,PC}\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF87A340_my() {
+     asm volatile (
+          "STMFD   SP!, {R4-R8,LR}\n"
+          "LDR     R7, =0x8002\n"
+          "LDR     R4, =0x62AC\n"
+          "CMP     R0, #3\n"
+          "MOV     R6, R1\n"
+          "MOV     R5, #1\n"
+          "BEQ     loc_FF87A4B4\n"
+          "BGT     loc_FF87A37C\n"
+          "CMP     R0, #0\n"
+          "BEQ     loc_FF87A3C0\n"
+          "CMP     R0, #1\n"
+          "BEQ     loc_FF87A444\n"
+          "CMP     R0, #2\n"
+          "BNE     loc_FF87A53C\n"
+          "B       loc_FF87A394\n"
+
+     "loc_FF87A37C:\n"
+          "CMP     R0, #6\n"
+          "STREQ   R5, [R4,#0x28]\n"
+          "BEQ     loc_FF87A4AC\n"
+          "SUB     R12, R0, #0x2000\n"
+          "SUBS    R12, R12, #4\n"
+          "BNE     loc_FF87A53C\n"
+
+     "loc_FF87A394:\n"
+          "SUB     R12, R6, #0x1100\n"
+          "SUBS    R12, R12, #0x62\n"
+          "BNE     loc_FF87A3B0\n"
+          "MOV     R1, R7\n"
+          "MOV     R0, #0\n"
+          "BL      sub_FF87E1BC\n"
+          "STR     R5, [R4,#0x60]\n"
+
+     "loc_FF87A3B0:\n"
+          "BL      sub_FF87D148\n"
+          "BL      sub_FF87CFA4\n"
+          "BL      sub_FF879E48\n"
+          "B       loc_FF87A534\n"
+
+     "loc_FF87A3C0:\n"
+          "MOV     R0, #7\n"
+          "BL      sub_FF87980C\n"
+          "MOV     R0, R7\n"
+          "BL      sub_FF82DC50\n"
+          "BL      sub_FF87BFB4\n"
+          "BL      sub_FF87CE1C\n"
+          "MOV     R1, R7\n"
+          "MOV     R0, #0\n"
+          "BL      sub_FF87E1BC\n"
+          //"ADR     R1, aAcBootrec\n"             // \"AC:BootRec\"
+          "LDR     R1, =0xFF87A574\n"             // \"AC:BootRec\"
+          "MOV     R0, #0x20\n"
+          "STR     R6, [R4,#0x18]\n"
+          "BL      sub_FF872A58\n"
+          //"ADR     R1, aAcInitlens\n"            // \"AC:InitLens\"
+          "LDR     R1, =0xFF87A580\n"            // \"AC:InitLens\"
+          "MOV     R0, #0x20\n"
+          "BL      sub_FF872A58\n"
+          "STR     R5, [R4,#0x28]\n"
+          "BL      sub_FF82DDF8\n"
+          "BL      sub_FF82DD3C\n"
+          "LDR     R0, [R4,#0x1C]\n"
+          "LDR     R1, [R4,#0x20]\n"
+          "ORRS    R0, R0, R1\n"
+          "BLNE    sub_FF87B0E4\n"
+          "LDR     R0, [R4,#0x68]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF87A430\n"
+          "BL      sub_FF82DE68\n"
+          "B       loc_FF87A438\n"
+
+     "loc_FF87A430:\n"
+          "BL      sub_FF8269E8\n"
+          "BL      sub_FF82E700\n"
+
+     "loc_FF87A438:\n"
+          //"BL      sub_FF87BF78\n"
+          "BL      sub_FF87BF78_my\n"            // +----> Hook for SDHC booting
+          "BL      sub_FF87BFF0\n"
+          "B       loc_FF87A534\n"
+
+     "loc_FF87A444:\n"
+          "MOV     R0, #8\n"
+          "BL      sub_FF87980C\n"
+          "BL      sub_FF87BFB4\n"
+          "BL      sub_FF87CE1C\n"
+          "LDR     R5, =0x4004\n"
+          "MOV     R0, #0\n"
+          "MOV     R1, R5\n"
+          "BL      sub_FF87E1BC\n"
+          //"ADR     R1, aAcBootpb\n"              // \"AC:BootPB\"
+          "LDR     R1, =0xFF87A590\n"              // \"AC:BootPB\"
+          "MOV     R0, #0x20\n"
+          "BL      sub_FF872A58\n"
+          //"BL      sub_FF87BF78\n"
+          "BL      sub_FF87BF78_my\n"            // +----> Hook for SDHC booting
+          "BL      sub_FF87C08C\n"
+          "BL      sub_FF82E690\n"
+          "MOV     R0, R5\n"
+          "BL      sub_FF82DC50\n"
+          "LDR     R0, [R4,#0x68]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF87A498\n"
+          "BL      sub_FF82DE68\n"
+          "B       loc_FF87A49C\n"
+
+     "loc_FF87A498:\n"
+          "BL      sub_FF8269E8\n"
+
+     "loc_FF87A49C:\n"
+          "BL      sub_FF87C020\n"
+          "LDR     R0, [R4,#0x30]\n"
+          "CMP     R0, #0\n"
+          "BEQ     loc_FF87A534\n"
+
+     "loc_FF87A4AC:\n"
+          "BL      sub_FF87B108\n"
+          "B       loc_FF87A534\n"
+
+     "loc_FF87A4B4:\n"
+          "MOV     R1, R6\n"
+          "MOV     R0, #0\n"
+          "BL      sub_FF87E1BC\n"
+          //"ADR     R1, aAcBootclock\n"           // \"AC:BootClock\"
+          "LDR     R1, =0xFF87A59C\n"           // \"AC:BootClock\"
+          "MOV     R0, #0x20\n"
+          "BL      sub_FF872A58\n"
+          "STR     R5, [R4,#0x68]\n"
+          "BL      sub_FF87C08C\n"
+          "BL      sub_FF82E690\n"
+          "BL      sub_FF87B0B4\n"
+          "BL      sub_FF82E764\n"
+          "CMP     R0, #0\n"
+          "LDRNE   R0, =0x8045\n"
+          "MOVNE   R1, #0\n"
+          "BLNE    sub_FF8789D4\n"
+          "BL      sub_FF87DFD0\n"
+          "MOV     R0, #0x80\n"
+          "BL      sub_FF82DC50\n"
+          "BL      sub_FF87D2D8\n"
+          "BL      sub_FF8B0EB4\n"
+          "BL      sub_FF973218\n"
+          "BL      sub_FF8AF708\n"
+          "BL      sub_FF87C9E4\n"
+          "BL      sub_FF87D180\n"
+          "MOV     R0, #9\n"
+          "BL      sub_FF87980C\n"
+          "LDR     R0, =0x300E\n"
+          "MOV     R1, R6\n"
+          "BL      sub_FF876100\n"
+          "MOV     R1, #0\n"
+          "MOV     R0, #1\n"
+          "BL      sub_FF87E1BC\n"
+
+     "loc_FF87A534:\n"
+          "MOV     R0, #0\n"
+          "LDMFD   SP!, {R4-R8,PC}\n"
+
+     "loc_FF87A53C:\n"
+          "MOV     R0, #1\n"
+          "LDMFD   SP!, {R4-R8,PC}\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF87BF78_my() {
+     asm volatile (
+
+          "LDR     R0, =0x6380\n"
+          "STMFD   SP!, {R3,LR}\n"
+          "LDR     R1, [R0,#0x10]\n"
+          "CMP     R1, #1\n"
+          "BEQ     locret_FF87BFB0\n"
+          "MOV     R1, #1\n"
+          "STR     R1, [R0,#0x10]\n"
+          "MOV     R3, #0\n"
+          "STR     R3, [SP,#8-8]\n"
+          //"LDR     R3, =sub_FF87BF28\n"
+          "LDR     R3, =sub_FF87BF28_my\n"       // +----> Hook for SDHC booting
+          "MOV     R1, #0x19\n"
+          //"LDR     R0, =aInitfilemodule\n"        // \"InitFileModules\"
+          "LDR     R0, =0xFF87C0F8\n"
+          "MOV     R2, #0x1000\n"
+          "BL      sub_FF81B8FC\n"
+
+     "locret_FF87BFB0:\n"
+          "LDMFD   SP!, {R12,PC}\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF87BF28_my() {
+     asm volatile (
+          "STMFD   SP!, {R4-R6,LR}\n"
+          "BL      sub_FF874FB0\n"
+          "LDR     R5, =0x5006\n"
+          "MOVS    R4, R0\n"
+          "MOVNE   R1, #0\n"
+          "MOVNE   R0, R5\n"
+          "BLNE    sub_FF876100\n"
+          //"BL      sub_FF874FDC\n"
+          "BL      sub_FF874FDC_my\n"            // +----> Hook for SDHC booting
+
+          "BL      core_spytask_can_start\n"     // +----> CHDK: Set "it's-safe-to-start"-Flag for spytask
+
+          "CMP     R4, #0\n"
+          "MOVEQ   R0, R5\n"
+          "LDMEQFD SP!, {R4-R6,LR}\n"
+          "MOVEQ   R1, #0\n"
+          "BEQ     sub_FF876100\n"
+          "LDMFD   SP!, {R4-R6,PC}\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF874FDC_my() {
+     asm volatile (
+          "STMFD   SP!, {R4,LR}\n"
+          //"BL      sub_FF856910\n"
+          "BL      sub_FF856910_my\n"            // +----> Hook for SDHC booting
+          "LDR     R4, =0x5C88\n"
+          "LDR     R0, [R4,#4]\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FF87500C\n"
+          "BL      sub_FF888178\n"
+          "BL      sub_FF9274EC\n"
+          "BL      sub_FF888178\n"
+          "BL      sub_FF933CC0\n"
+          "BL      sub_FF888188\n"
+          "BL      sub_FF927594\n"
+
+     "loc_FF87500C:\n"
+          "MOV     R0, #1\n"
+          "STR     R0, [R4]\n"
+          "LDMFD   SP!, {R4,PC}\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF856910_my() {
+     asm volatile (
+          "STMFD   SP!, {R4-R6,LR}\n"
+          "MOV     R6, #0\n"
+          "MOV     R0, R6\n"
+          "BL      sub_FF8564E0\n"
+          "LDR     R4, =0x131E4\n"
+          "MOV     R5, #0\n"
+          "LDR     R0, [R4,#0x38]\n"
+          "BL      sub_FF856EA8\n"
+          "CMP     R0, #0\n"
+          "LDREQ   R0, =0x2EB4\n"
+          "STREQ   R5, [R0,#0xC]\n"
+          "STREQ   R5, [R0,#0x10]\n"
+          "STREQ   R5, [R0,#0x14]\n"
+          "MOV     R0, R6\n"
+          "BL      sub_FF856520\n"
+          "MOV     R0, R6\n"
+          //"BL      sub_FF85674C\n"
+          "BL      sub_FF85674C_my\n"            // +----> Hook for SDHC booting
+          "MOV     R5, R0\n"
+          "MOV     R0, R6\n"
+          "BL      sub_FF8567B8\n" 
+          "LDR     R1, [R4,#0x3C]\n"
+          "AND     R2, R5, R0\n"
+          "CMP     R1, #0\n"
+          "MOV     R0, #0\n"
+          "MOVEQ   R0, #0x80000001\n"
+          "BEQ     loc_FF8569A4\n"
+          "LDR     R3, [R4,#0x2C]\n"
+          "CMP     R3, #2\n"
+          "MOVEQ   R0, #4\n"
+          "CMP     R1, #5\n"
+          "ORRNE   R0, R0, #1\n"
+          "BICEQ   R0, R0, #1\n"
+          "CMP     R2, #0\n"
+          "BICEQ   R0, R0, #2\n"
+          "ORREQ   R0, R0, #0x80000000\n"
+          "BICNE   R0, R0, #0x80000000\n"
+          "ORRNE   R0, R0, #2\n"
+
+     "loc_FF8569A4:\n"
+          "STR     R0, [R4,#0x40]\n"
+          "LDMFD   SP!, {R4-R6,PC}\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF85674C_my() {
+     asm volatile (
+          "STMFD   SP!, {R4-R6,LR}\n"
+          "LDR     R5, =0x2EB4\n"
+          "MOV     R6, R0\n"
+          "LDR     R0, [R5,#0x10]\n"
+          "CMP     R0, #0\n"
+          "MOVNE   R0, #1\n"
+          "LDMNEFD SP!, {R4-R6,PC}\n"
+          "MOV     R0, #0x17\n"
+          "MUL     R1, R0, R6\n"
+          "LDR     R0, =0x131E4\n"
+          "ADD     R4, R0, R1,LSL#2\n"
+          "LDR     R0, [R4,#0x38]\n"
+          "MOV     R1, R6\n"
+          //"BL      sub_FF8565E4\n"
+          "BL      sub_FF8565E4_my\n"            // +----> Hook for SDHC booting
+          "CMP     R0, #0\n"
+          "LDMEQFD SP!, {R4-R6,PC}\n"
+          "LDR     R0, [R4,#0x38]\n"
+          "MOV     R1, R6\n"
+          "BL      sub_FF856FC0\n"
+          "CMP     R0, #0\n"
+          "LDMEQFD SP!, {R4-R6,PC}\n"
+          "MOV     R0, R6\n"
+          "BL      sub_FF856100\n"
+          "CMP     R0, #0\n"
+          "MOVNE   R1, #1\n"
+          "STRNE   R1, [R5,#0x10]\n"
+          "LDMFD   SP!, {R4-R6,PC}\n"
+     );
+}
+
+void __attribute__((naked,noinline)) sub_FF8565E4_my() {
+     asm volatile (
+          "STMFD   SP!, {R4-R8,LR}\n"
+          "MOV     R8, R0\n"
+          "MOV     R0, #0x17\n"
+          "MUL     R1, R0, R1\n"
+          "LDR     R0, =0x131E4\n"
+          "MOV     R6, #0\n"
+          "ADD     R7, R0, R1,LSL#2\n"
+          "LDR     R0, [R7,#0x3C]\n"
+          "MOV     R5, #0\n"
+          "CMP     R0, #6\n"
+          "ADDLS   PC, PC, R0,LSL#2\n"
+          "B       loc_FF856730\n"
+
+     "loc_FF856614:\n"
+          "B       loc_FF856648\n"
+
+     "loc_FF856618:\n"
+          "B       loc_FF856630\n"
+
+     "loc_FF85661C:\n"
+          "B       loc_FF856630\n"
+
+     "loc_FF856620:\n"
+          "B       loc_FF856630\n"
+
+     "loc_FF856624:\n"
+          "B       loc_FF856630\n"
+
+     "loc_FF856628:\n"
+          "B       loc_FF856728\n"
+
+     "loc_FF85662C:\n"
+          "B       loc_FF856630\n"
+
+     "loc_FF856630:\n"
+          "MOV     R2, #0\n"
+          "MOV     R1, #0x200\n"
+          "MOV     R0, #3\n"
+          "BL      sub_FF8716C4\n"
+          "MOVS    R4, R0\n"
+          "BNE     loc_FF856650\n"
+
+     "loc_FF856648:\n"
+          "MOV     R0, #0\n"
+          "LDMFD   SP!, {R4-R8,PC}\n"
+
+     "loc_FF856650:\n"
+          "LDR     R12, [R7,#0x4C]\n"
+          "MOV     R3, R4\n"
+          "MOV     R2, #1\n"
+          "MOV     R1, #0\n"
+          "MOV     R0, R8\n"
+          //"BLX     R12\n"      // WORKSFORME, configure gcc WITHOUT --with-cpu=arm9
+          "MOV     LR, PC\n"     // 2-op workaround for 'normal' compiler
+          "MOV     PC, R12\n"    // Does the same thing, effectively, because PC is always 8 bytes ahead.
+          "CMP     R0, #1\n"
+          "BNE     loc_FF85667C\n"
+          "MOV     R0, #3\n"
+          "BL      sub_FF871544\n"
+          "B       loc_FF856648\n"
+
+///////
+// Offsets are fixed from here on, everything +0x10 for the second entry
+///////
+
+     "loc_FF85667C:\n"
+          "MOV     R0, R8\n"
+          "BL      sub_FF94450C\n"
+
+          // Start of DataGhost's FAT32 autodetection code
+          // Policy: If there is a partition which has type W95 FAT32, use the first one of those for image storage
+          // According to the code below, we can use R1, R2, R3 and R12.
+          // LR wasn't really used anywhere but for storing a part of the partition signature. This is the only thing
+          // that won't work with an offset, but since we can load from LR+offset into LR, we can use this to do that :)
+          "MOV     R12, R4\n"                    // Copy the MBR start address so we have something to work with
+          "MOV     LR, R4\n"                     // Save old offset for MBR signature
+          "MOV     R1, #1\n"                     // Note the current partition number
+          "B       dg_sd_fat32_enter\n"          // We actually need to check the first partition as well, no increments yet!
+     "dg_sd_fat32:\n"
+          "CMP     R1, #4\n"                     // Did we already see the 4th partition?
+          "BEQ     dg_sd_fat32_end\n"            // Yes, break. We didn't find anything, so don't change anything.
+          "ADD     R12, R12, #0x10\n"            // Second partition
+          "ADD     R1, R1, #1\n"                 // Second partition for the loop
+     "dg_sd_fat32_enter:\n"
+          "LDRB    R2, [R12, #0x1BE]\n"          // Partition status
+          "LDRB    R3, [R12, #0x1C2]\n"          // Partition type (FAT32 = 0xB)
+          "CMP     R3, #0xB\n"                   // Is this a FAT32 partition?
+          "CMPNE   R3, #0xC\n"                   // Not 0xB, is it 0xC (FAT32 LBA) then?
+          "BNE     dg_sd_fat32\n"                // No, it isn't. Loop again.
+          "CMP     R2, #0x00\n"                  // It is, check the validity of the partition type
+          "CMPNE   R2, #0x80\n"
+          "BNE     dg_sd_fat32\n"                // Invalid, go to next partition
+                                                 // This partition is valid, it's the first one, bingo!
+          "MOV     R4, R12\n"                    // Move the new MBR offset for the partition detection.
+          
+     "dg_sd_fat32_end:\n"
+          // End of DataGhost's FAT32 autodetection code
+
+          "LDRB    R1, [R4,#0x1C9]\n"            // 4th byte of LBA
+          "LDRB    R3, [R4,#0x1C8]\n"            // 3rd byte of LBA
+          "LDRB    R12, [R4,#0x1CC]\n"           // 3rd byte of partition length
+          "MOV     R1, R1,LSL#24\n"              // Shift and...
+          "ORR     R1, R1, R3,LSL#16\n"          // combine LBA bytes (endianness fix)
+          "LDRB    R3, [R4,#0x1C7]\n"            // 2nd byte of LBA
+          "LDRB    R2, [R4,#0x1BE]\n"            // Partition status (0x00=nonboot, 0x80=boot, other=bad)
+//          "LDRB    LR, [R4,#0x1FF]\n"            // Last MBR signature byte (0xAA)
+          "ORR     R1, R1, R3,LSL#8\n"           // Combine more LBA bytes
+          "LDRB    R3, [R4,#0x1C6]\n"            // 1st byte of LBA
+          "CMP     R2, #0\n"                     // Check partition status
+          "CMPNE   R2, #0x80\n"                  // and again
+          "ORR     R1, R1, R3\n"                 // Combine LBA into final value
+          "LDRB    R3, [R4,#0x1CD]\n"            // 4th byte of partition length
+          "MOV     R3, R3,LSL#24\n"              // Shift and...
+          "ORR     R3, R3, R12,LSL#16\n"         // combine partition length bytes
+          "LDRB    R12, [R4,#0x1CB]\n"           // 2nd byte of partition length
+          "ORR     R3, R3, R12,LSL#8\n"          // Combine partition length bytes
+          "LDRB    R12, [R4,#0x1CA]\n"           // 1st byte of partition length
+          "ORR     R3, R3, R12\n"                // Combine partition length bytes into final value
+//          "LDRB    R12, [R4,#0x1FE]\n"           // First MBR signature byte (0x55)
+          "LDRB    R12, [LR,#0x1FE]\n"           // + First MBR signature byte (0x55), LR is original offset.
+          "LDRB    LR, [LR,#0x1FF]\n"            // + Last MBR signature byte (0xAA), LR is original offset.
+          "MOV     R4, #0\n"                     // This value previously held a pointer to the partition table :(
+          "BNE     loc_FF856704\n"               // Jump out if the partition is malformed (partition status \'other\')
+          "CMP     R0, R1\n"
+          "BCC     loc_FF856704\n"               // Jump out if R0 < R1 (probably checking for a valid LBA addr)
+          "ADD     R2, R1, R3\n"                 // R2 = partition start address + length = partition end address
+          "CMP     R2, R0\n"                     // Guess: CMPLS is used to check for an overflow, the partition end address cannot be negative.
+          "CMPLS   R12, #0x55\n"                 // Check MBR signature with original offset
+          "CMPEQ   LR, #0xAA\n"                  // Check MBR signature with original offset
+          "MOVEQ   R6, R1\n"
+          "MOVEQ   R5, R3\n"
+          "MOVEQ   R4, #1\n"
+
+     "loc_FF856704:\n"
+          "MOV     R0, #3\n"
+          "BL      sub_FF871544\n"
+          "CMP     R4, #0\n"
+          "BNE     loc_FF85673C\n"
+          "MOV     R6, #0\n"
+          "MOV     R0, R8\n"
+          "BL      sub_FF94450C\n"
+          "MOV     R5, R0\n"
+          "B       loc_FF85673C\n"
+
+     "loc_FF856728:\n"
+          "MOV     R5, #0x40\n"
+          "B       loc_FF85673C\n"
+
+     "loc_FF856730:\n"
+          "LDR     R1, =0x365\n"
+          //"ADR     R0, aMounter_c\n"             // \"Mounter.c\"
+          "LDR     R0, =0xFF8565D8\n"
+          //"BL      Assert\n"
+          "BL      sub_FF81BCCC\n"
+
+     "loc_FF85673C:\n"
+          "STR     R6, [R7,#0x44]!\n"
+          "MOV     R0, #1\n"
+          "STR     R5, [R7,#4]\n"
+          "LDMFD   SP!, {R4-R8,PC}\n"
+     );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// SDHC HOOK ENDS HERE
+////////////////////////////////////////////////////////////////////////////////
+
+
+// I could not manually find this function in the S5IS firmware, possibly signatures
+// might find it. Until that moment, I hooked it here (copied from another camera)
+unsigned long __attribute__((naked,noinline)) _time(unsigned long *timer) {
+     asm volatile (
+          "STMFD   SP!, {R3-R5,LR}\n"
+          "MOV     R4, R0\n"
+          "MVN     R0, #0\n"
+          "STR     R0, [SP,#0x10-0x10]\n"
+          "MOV     R0, SP\n"
+          "BL      sub_FF870BB8\n" // _GetTimeOfSystem\n"
+          "CMP     R0, #0\n"
+          "BNE     loc_FFC55F38\n"
+          "CMP     R4, #0\n"
+          "LDRNE   R0, [SP,#0x10-0x10]\n"
+          "STRNE   R0, [R4]\n"
+
+     "loc_FFC55F38:\n"
+          "LDR     R0, [SP,#0x10-0x10]\n"
+          "LDMFD   SP!, {R3-R5,PC}\n"
+     );
+}
+
+
+
+void CreateTask_blinker() {
+        _CreateTask("Blinker", 0x1, 0x200, task_blinker, 0);
+};
+
+
+void __attribute__((naked,noinline)) task_blinker() {
+        int ledstate;
+
+        int counter = 0;
+
+        long *led = (void*) 0xC02200E0;   // AF led
+
+        long *anypointer;       // multi-purpose pointer to poke around in memory
+        long v1, v2, v3, v4;    // multi-purpose vars
+
+        ledstate = 0;   // init: led off
+        *led = 0x46;      // led on
+
+        while (1) {
+                counter++;
+
+                if (ledstate == 1) {    // toggle LED
+                        ledstate = 0;
+                        *led = 0x44;      // LED off
+                        //core_test(1);
+                } else {
+                        ledstate = 1;
+                        *led = 0x46;      // LED on
+                        //core_test(0);
+                }
+
+                if (counter == 2) {
+                        //dump_chdk();
+                        //gui_init();
+                        //_ExecuteEventProcedure("UIFS_WriteFirmInfoToFile");
+                        //_UIFS_WriteFirmInfoToFile(0);
+                }
+
+                if (counter == 10) {
+                        //draw_txt_string(2, 2, "test");
+                }
+
+                msleep(500);
+        }
+};
+
+
+void CreateTask_spytask() {
+        _CreateTask("SpyTask", 0x19, 0x2000, core_spytask, 0);
+};
+
+
+void CreateTask_PhySw() {
+        _CreateTask("PhySw", 0x17, 0x800, mykbd_task, 0);
+};
+
+
+//extern long _Fopen_Fut(const char *filename, const char *mode);
+//extern void _Fclose_Fut(long file);
+//extern long _Fwrite_Fut(const void *buf, long elsize, long count, long f);
+//extern long Fread_Fut(void *buf, long elsize, long count, long f);
+//extern long Fseek_Fut(long file, long offset, long whence);
+//extern long _qDump(char* filename, long unused, long write_p2, long write_p3);
+void dump_chdk() { //#fs
+    int fd;
+    long dirnum;
+        
+    volatile long *led = (void*) 0xC02200D0;   // yellow led
+
+    *led = 0x46; //on 
+
+  //  _qDump("A/qdump", 0, (void*) 0x01900, 0xb0000);
+    //_qDump("A/firmdump", 0, (void*) 0xffc00000, 0x00400000);
+    //_qDump("A/firmlower", 0, (void*) 0xff800000, 0x00400000); // identical to 0xfc000000
+
+    //started();
+
+	//dirnum = get_target_dir_num();
+	//sprintf(fn, FN_RAWDIR, dirnum);
+	//mkdir(fn);
+
+	//sprintf(fn, FN_RAWDIR "/" "DMP_%04d.JPG", dirnum, ++ramdump_num);
+
+	//fd = _Fopen_Fut("A/dump", "w");
+	//if (fd >= 0) {
+	    //write(fd, (void*)0, 0x1900);
+	    //write(fd, (void*)0x1900, 32*1024*1024-0x1900);
+            //_Fwrite_Fut((void*)0x9D000, 0x20000, 0x20000, fd);
+	    //_Fclose_Fut(fd);
+	//}
+    *led = 0x44; //off
+    //finished();
+} //#fe
Index: /trunk/platform/s5is/sub/101b/stubs_min.S
===================================================================
--- /trunk/platform/s5is/sub/101b/stubs_min.S	(revision 511)
+++ /trunk/platform/s5is/sub/101b/stubs_min.S	(revision 511)
@@ -0,0 +1,95 @@
+#include "stubs_asm.h"
+
+// from kbd_read_keys
+// found at ROM:FF8238C8
+DEF(physw_status, 0x11ABC)
+
+
+// from task_physw, exit-condition. R4 = base; R0 = [R4 + offset] => physw_run
+// found at ROM:FF8235A4
+// ROM:FF8235A4   LDR     R4, =0x1CD0
+// ..
+// ROM:FF8235C0   LDR     R0, [R4,#8]
+// ROM:FF8235C4   CMP     R0, #0
+// ROM:FF8235C8   BNE     loc_FF8235AC
+// ROM:FF8235CC   LDMFD   SP!, {R4,LR}
+// ROM:FF8235D0   B       ExitTask
+DEF(physw_run, 0x1CD8)
+
+
+// found in taskcreate_LEDCon (sub_FF84CCD0)
+// ROM:FF84CCD4   LDR     R4, =0x270C     @ Base addr
+// ROM:FF84CCD8   LDR     R0, [R4]        @ Load value (dereference)
+// ROM:FF84CCDC   CMP     R0, #0          @ If it's not 0, it's already initialized,
+// ROM:FF84CCE0   BNE     locret_FF84CDC8 @ so return.
+// ROM:FF84CCE4   MOV     R0, #0x3C0      @ Else (if it's 1)
+// ROM:FF84CCE8   BL      sub_FF82AC28    @ R0 = malloc(0x3C0); // allocate the LED table
+// ..
+// ROM:FF84CCFC   STR     R0, [R4,#4]     @ Store the address of the LED table (base+4)
+DEF(led_table, 0x2710) // 0x270C + 4
+
+
+// found at ROM:FFA4503C
+DEF(FlashParamsTable,0xFFAEFF98)
+
+
+// found in sub_FF957174 (called from MoveZoomLensWithPoint (sub_FF957B34))
+// ROM:FF957178   LDR     R4, =0xB37C
+// ..
+// ROM:FF9571BC   LDR     R0, [R4,#0x34]
+// ROM:FF9571C0   CMP     R0, #0
+// ROM:FF9571C4   MOVNE   R1, #0xE0
+// ROM:FF9571C8   ADRNE   R0, aZoomlenscontro @ "ZoomLensController.c"
+// ROM:FF9571CC   BLNE    assert
+DEF(zoom_busy, 0xB3B0)  //0xB37C + 0x34
+
+
+// Found in sub_FF950718 (<- sub_FFA0D148 <- sub_FFA0D394 <- sub_FFA0D408
+//                                    <- MoveFocusLensToDistance (sub_FFA0D41C))
+// ROM:FF95071C   LDR     R4, =0xB274
+// ..
+// ROM:FF950770   LDR     R0, [R4,#8]
+// ROM:FF950774   CMP     R0, #0
+// ROM:FF950778   MOVNE   R1, #0x90
+// ROM:FF95077C   ADRNE   R0, aFocuslenscontr @ "FocusLensController.c"
+// ROM:FF950780   BLNE    assert
+DEF(focus_busy, 0xB27C) //0xB274 + 8
+
+
+// Found in StartRecModeMenu (sub_FF897010)
+// ROM:FF897014   LDR     R5, =0x6E38
+// ROM:FF897018   LDR     R0, [R5,#4]
+// ROM:FF89701C   ADD     R1, R5, #0
+// ROM:FF897020   CMP     R0, R1
+// ROM:FF897024   LDMNEFD SP!, {R4-R6,PC}
+DEF(canon_menu_active,0x6E3C) // 0x63E8 + 4
+
+// Same as previous variable, unusable. Originally found it by peeking through
+// memory and it looked suitable at first. This address along with 0xBE64
+// (suitable as canon_shoot_menu_active, code agrees) looked suitable but I got
+// the basic idea wrong. Listed for completeness.
+//DEF(canon_menu_active,0xBEB4)
+
+
+// Found in sub_FF982310 (deactivates shoot menu?). Ewavr found it but didn't
+// clearly specify where, so this is a guess.
+// ROM:FF982310   LDR     R1, =0xC05C
+// ROM:FF982314   MOV     R0, #0
+// ROM:FF982318   STRB    R0, [R1]
+// ROM:FF98231C   STRB    R0, [R1,#1]
+DEF(canon_shoot_menu_active,0xC05D) // 0xC05C + 1
+
+
+// Found in sub_FF9754AC. Again, ewavr found this one, he did supply one pointer
+// 'search for LDR R12, =0x3007'. I guess this is the right one then :)
+// ROM:FF9754AC 000                 STMFD   SP!, {R4,LR}
+// ROM:FF9754B0 008                 LDR     R1, =0xBD60
+// ROM:FF9754B4 008                 LDR     R12, =0x3007
+// ROM:FF9754B8 008                 LDR     R2, [R1,#0xCC]
+DEF(recreview_hold, 0xBE2C) // 0xBD60 + 0xCC
+DEF(movie_status,0x5868 + 0x38)
+
+
+
+
+
Index: /trunk/platform/s5is/sub/101b/makefile.inc
===================================================================
--- /trunk/platform/s5is/sub/101b/makefile.inc	(revision 511)
+++ /trunk/platform/s5is/sub/101b/makefile.inc	(revision 511)
@@ -0,0 +1,15 @@
+# USB ID: 04a9:3148
+PLATFORMID=12616
+
+PLATFORMOS=dryos
+
+MEMBASEADDR=0x1900
+RESTARTSTART=0x50000
+MEMISOSTART=0x9B610
+MEMISOSIZE=0x55000
+ROMBASEADDR=0xff810000
+
+TARGET_PRIMARY=$(topdir)platform/$(PLATFORM)/sub/$(PLATFORMSUB)/PRIMARY.BIN
+
+PLFLAGS=-DMEMBASEADDR=$(MEMBASEADDR) -DMEMISOSTART=$(MEMISOSTART) -DMEMISOSIZE=$(MEMISOSIZE)
+PLFLAGS+=-DRESTARTSTART=$(RESTARTSTART)
Index: /trunk/platform/s5is/sub/101b/stubs_asm.h
===================================================================
--- /trunk/platform/s5is/sub/101b/stubs_asm.h	(revision 511)
+++ /trunk/platform/s5is/sub/101b/stubs_asm.h	(revision 511)
@@ -0,0 +1,20 @@
+    .text
+
+#define DEF(n,a) \
+    .globl n; n = a
+
+#define NSTUB(name, addr)\
+    .globl _##name ;\
+    .weak _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define NHSTUB(name, addr)\
+    .globl _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define STUB(addr)\
+    .globl sub_ ## addr ;\
+    sub_ ## addr: ;\
+	ldr  pc, =0x ## addr
Index: /trunk/platform/s5is/sub/101b/lib.c
===================================================================
--- /trunk/platform/s5is/sub/101b/lib.c	(revision 511)
+++ /trunk/platform/s5is/sub/101b/lib.c	(revision 511)
@@ -0,0 +1,120 @@
+#include "platform.h"
+
+void *hook_raw_fptr()
+{
+	return (void*)0; // What does this do? Doesn't seem to be called
+}
+
+void *hook_raw_ret_addr()
+{
+	return (void*)0; // What does this do? Doesn't seem to be called
+}
+
+char *hook_raw_image_addr()
+{
+	// Found at ROM:FFA11E84
+	// Search for aCrawBuffP and search backwards for the second printf argument
+	// ROM:FFA11E84   LDR     R6, =0x1163B8E0
+	// .....
+	// ROM:FFA11ED4   MOV     R1, R6
+	// ROM:FFA11ED8   ADR     R0, aCrawBuffP  @ "CRAW BUFF       %p"
+	// ROM:FFA11EDC   BL      sub_FFA13590
+
+	return (char*)0x1163B8E0;
+}
+
+long hook_raw_size()
+{
+	// Found at ROM:FFA11EE0
+	// Search for aCrawBuffSizeP, take value from second printf argument
+	// ROM:FFA11EE0   LDR     R1, =0x9DCCE0
+	// ROM:FFA11EE4   ADR     R0, aCrawBuffSizeP @ "CRAW BUFF SIZE  %p"
+	// ROM:FFA11EE8   BL      sub_FFA13590
+	
+	return 0x9DCCE0;
+}
+
+void *vid_get_viewport_live_fb()
+{
+	// Deprecated, still exists for historical reasons.
+	// Should return null pointer.
+	
+	return (void*)0x0;
+/*    void **fb=(void **)0x10D29360;
+    unsigned char buff = *((unsigned char*)0x218C);
+    if (buff == 0) {
+        buff = 2;
+    }
+    else {
+        buff--;
+    }
+    return fb[buff * 0x7E900];*/
+}
+
+void *vid_get_bitmap_fb()
+{
+	// Found at ROM:FF912380
+	// Search for BmpDDev.c
+	
+	return (void*)0x10361000; 
+}
+
+void *vid_get_viewport_fb()
+{
+	// Found at ROM:FFA103D8
+	// Search for aVramAddressP
+	// ROM:FFA103D8   LDR     R1, =0x10D29360
+	// ROM:FFA103DC   LDR     R0, =0x7E900
+	// ROM:FFA103E0   STR     R1, [R4]
+	// ROM:FFA103E4   STR     R0, [R4,#4]
+	// ROM:FFA103E8   ADR     R0, aVramAddressP @ "VRAM Address  : %p\r"
+
+	return (void*)0x10D29360;
+}
+
+void *vid_get_viewport_fb_d()
+{
+	// Found in sub_FF85B3FC (unsure, seems to do the same as this function)
+	// Search for aImageplayer_c to get at least the base value (0x56D8)
+	// ROM:FF85B3FC   LDR     R0, =0x56D8
+	// ROM:FF85B400   LDR     R0, [R0,#0x4C]
+	// ROM:FF85B404   BX      LR
+
+	return (void*)(*(int*)0x5724);  // 0x56D8 + 0x4C
+}
+
+
+long vid_get_bitmap_screen_width()
+{
+	return 360;
+}
+
+long vid_get_bitmap_screen_height()
+{
+	return 240;
+}
+
+long vid_get_viewport_height()
+{
+	return 240;
+}
+
+char *camera_jpeg_count_str()
+{
+	// Found at ROM:FF9BE548.
+	// Search for a9999
+	// ROM:FF9BE548   LDR     R0, =0x58304
+	// ROM:FF9BE54C   ADR     R1, a9999       @ "9999"
+	// ROM:FF9BE550   BL      sprintf
+	
+	return (char*)0x58304;
+}
+
+
+
+
+
+long vid_get_bitmap_buffer_width() { return 360; }
+
+long vid_get_bitmap_buffer_height() { return 240; }
+
Index: /trunk/platform/s5is/sub/101b/stubs_auto.S
===================================================================
--- /trunk/platform/s5is/sub/101b/stubs_auto.S	(revision 511)
+++ /trunk/platform/s5is/sub/101b/stubs_auto.S	(revision 511)
@@ -0,0 +1,250 @@
+/* THIS FILE IS GENERATED */
+/* DO NOT EDIT THIS FILE! */
+
+#include "stubs_asm.h"
+
+STUB(FF81000C)
+STUB(FF8101B8)
+STUB(FF810970)
+STUB(FF810FCC)
+STUB(FF8114E4)
+STUB(FF812D84)
+STUB(FF813594)
+STUB(FF814A30)
+STUB(FF814B1C)
+STUB(FF814F00)
+STUB(FF8150D8)
+STUB(FF8151CC)
+STUB(FF8194B8)
+STUB(FF8197D0)
+STUB(FF81B798)
+STUB(FF81B868)
+STUB(FF81B8FC)
+STUB(FF81BB8C)
+STUB(FF81BBD4)
+STUB(FF81BC08)
+STUB(FF81BC2C)
+STUB(FF81BC50)
+STUB(FF81BCCC)
+STUB(FF81D9F0)
+STUB(FF820D4C)
+STUB(FF820E54)
+STUB(FF82124C)
+STUB(FF822728)
+STUB(FF8228A4)
+STUB(FF822998)
+STUB(FF822CC4)
+STUB(FF8230C0)
+STUB(FF8235D4)
+STUB(FF823630)
+STUB(FF824778)
+STUB(FF824CD8)
+STUB(FF824D04)
+STUB(FF824D18)
+STUB(FF8268FC)
+STUB(FF826988)
+STUB(FF8269E8)
+STUB(FF826C50)
+STUB(FF826C98)
+STUB(FF826FA0)
+STUB(FF829CD8)
+STUB(FF829F0C)
+STUB(FF82A274)
+STUB(FF82A2A8)
+STUB(FF82A4F8)
+STUB(FF82A9D0)
+STUB(FF82ABC4)
+STUB(FF82AC18)
+STUB(FF82CBF4)
+STUB(FF82CE28)
+STUB(FF82CF00)
+STUB(FF82D018)
+STUB(FF82D068)
+STUB(FF82DABC)
+STUB(FF82DACC)
+STUB(FF82DAEC)
+STUB(FF82DC50)
+STUB(FF82DCE4)
+STUB(FF82DD3C)
+STUB(FF82DDF8)
+STUB(FF82DE68)
+STUB(FF82DE8C)
+STUB(FF82DFAC)
+STUB(FF82E570)
+STUB(FF82E690)
+STUB(FF82E700)
+STUB(FF82E764)
+STUB(FF82E770)
+STUB(FF82E7A4)
+STUB(FF82EB04)
+STUB(FF84239C)
+STUB(FF8504F4)
+STUB(FF850A10)
+STUB(FF856100)
+STUB(FF8564E0)
+STUB(FF856520)
+STUB(FF8565E4)
+STUB(FF85674C)
+STUB(FF8567B8)
+STUB(FF856910)
+STUB(FF856EA8)
+STUB(FF856FC0)
+STUB(FF85FC7C)
+STUB(FF861F28)
+STUB(FF861F40)
+STUB(FF8641A8)
+STUB(FF864B94)
+STUB(FF864FD0)
+STUB(FF865CA0)
+STUB(FF866084)
+STUB(FF86633C)
+STUB(FF8663D8)
+STUB(FF866664)
+STUB(FF86677C)
+STUB(FF866F4C)
+STUB(FF867034)
+STUB(FF867D5C)
+STUB(FF86843C)
+STUB(FF8685C0)
+STUB(FF868A40)
+STUB(FF869B98)
+STUB(FF869C08)
+STUB(FF869ED0)
+STUB(FF869EF8)
+STUB(FF86A060)
+STUB(FF870BB8)
+STUB(FF871544)
+STUB(FF8716C4)
+STUB(FF872A58)
+STUB(FF87479C)
+STUB(FF87491C)
+STUB(FF874B10)
+STUB(FF874C08)
+STUB(FF874FB0)
+STUB(FF874FDC)
+STUB(FF875938)
+STUB(FF876100)
+STUB(FF877A7C)
+STUB(FF8789D4)
+STUB(FF878D88)
+STUB(FF878DAC)
+STUB(FF878E1C)
+STUB(FF879508)
+STUB(FF879540)
+STUB(FF8795E0)
+STUB(FF879614)
+STUB(FF879640)
+STUB(FF87972C)
+STUB(FF87980C)
+STUB(FF879928)
+STUB(FF879E48)
+STUB(FF879EA8)
+STUB(FF879F08)
+STUB(FF87A104)
+STUB(FF87A340)
+STUB(FF87A704)
+STUB(FF87A80C)
+STUB(FF87A9B8)
+STUB(FF87AB20)
+STUB(FF87AC88)
+STUB(FF87AF30)
+STUB(FF87B0B4)
+STUB(FF87B0E4)
+STUB(FF87B108)
+STUB(FF87B57C)
+STUB(FF87B5B8)
+STUB(FF87B658)
+STUB(FF87B788)
+STUB(FF87B868)
+STUB(FF87BADC)
+STUB(FF87BB1C)
+STUB(FF87BB94)
+STUB(FF87BBF8)
+STUB(FF87BD48)
+STUB(FF87BE64)
+STUB(FF87BF78)
+STUB(FF87BFB4)
+STUB(FF87BFF0)
+STUB(FF87C020)
+STUB(FF87C08C)
+STUB(FF87C310)
+STUB(FF87C380)
+STUB(FF87C9E4)
+STUB(FF87CD38)
+STUB(FF87CE1C)
+STUB(FF87CFA4)
+STUB(FF87D148)
+STUB(FF87D180)
+STUB(FF87D2D8)
+STUB(FF87DBD8)
+STUB(FF87DFD0)
+STUB(FF87E0E8)
+STUB(FF87E1BC)
+STUB(FF87E4D8)
+STUB(FF87E4E4)
+STUB(FF87F814)
+STUB(FF880F94)
+STUB(FF882260)
+STUB(FF882B70)
+STUB(FF883D08)
+STUB(FF886B40)
+STUB(FF888178)
+STUB(FF888188)
+STUB(FF89A628)
+STUB(FF89C658)
+STUB(FF89EF88)
+STUB(FF8AF708)
+STUB(FF8B0EB4)
+STUB(FF8BA34C)
+STUB(FF8BA350)
+STUB(FF8BA3D0)
+STUB(FF8BA47C)
+STUB(FF8BA4FC)
+STUB(FF91C04C)
+STUB(FF9274EC)
+STUB(FF927594)
+STUB(FF933CC0)
+STUB(FF94450C)
+STUB(FF95EE64)
+STUB(FF95F094)
+STUB(FF95F09C)
+STUB(FF95F0A4)
+STUB(FF95F0C8)
+STUB(FF95F1FC)
+STUB(FF95F28C)
+STUB(FF95F310)
+STUB(FF95F4AC)
+STUB(FF95F560)
+STUB(FF95F5A8)
+STUB(FF95F60C)
+STUB(FF95F7F0)
+STUB(FF95FBD4)
+STUB(FF95FE20)
+STUB(FF96001C)
+STUB(FF960100)
+STUB(FF9601B4)
+STUB(FF960420)
+STUB(FF96042C)
+STUB(FF960564)
+STUB(FF960618)
+STUB(FF96065C)
+STUB(FF9606B0)
+STUB(FF9607D0)
+STUB(FF960864)
+STUB(FF960918)
+STUB(FF960A6C)
+STUB(FF960EBC)
+STUB(FF960F8C)
+STUB(FF961314)
+STUB(FF961374)
+STUB(FF9617AC)
+STUB(FF961898)
+STUB(FF9618E8)
+STUB(FF973218)
+STUB(FF9732F0)
+STUB(FF9D0314)
+STUB(FF9D031C)
+STUB(FF9D0324)
+STUB(FF9D032C)
+STUB(FFA402C0)
+STUB(FFA92C10)
Index: /trunk/platform/s5is/sub/101b/Makefile
===================================================================
--- /trunk/platform/s5is/sub/101b/Makefile	(revision 511)
+++ /trunk/platform/s5is/sub/101b/Makefile	(revision 511)
@@ -0,0 +1,6 @@
+topdir=../../../../
+
+OBJS=boot.o stubs_min.o stubs_auto.o stubs_entry.o lib.o stubs_entry_2.o capt_seq.o
+STUBS_AUTO_DEPS=boot.c capt_seq.c
+
+include $(topdir)/platform/makefile_sub.inc
Index: /trunk/platform/s5is/sub/Makefile
===================================================================
--- /trunk/platform/s5is/sub/Makefile	(revision 511)
+++ /trunk/platform/s5is/sub/Makefile	(revision 511)
@@ -0,0 +1,8 @@
+topdir=../../../
+include $(topdir)makefile.inc
+
+SUBDIRS=$(PLATFORMSUB)
+
+all: all-recursive
+
+clean: clean-recursive
Index: /trunk/platform/s5is/shooting.c
===================================================================
--- /trunk/platform/s5is/shooting.c	(revision 511)
+++ /trunk/platform/s5is/shooting.c	(revision 511)
@@ -0,0 +1,112 @@
+#define PARAM_FILE_COUNTER      0x37
+#define PARAM_EXPOSURE_COUNTER  0x02
+
+// DRYOS-Notes:
+// propertycase
+//   196 - overall brightness (of viewport?)
+
+#include "platform.h"
+
+const ApertureSize aperture_sizes_table[] = {
+	{  9, 283, "2.7" },
+	{ 10, 320, "3.2" },
+	{ 11, 352, "3.5" },
+	{ 12, 384, "4.0" },
+	{ 13, 416, "4.5" },
+	{ 14, 448, "5.0" },
+	{ 15, 480, "5.6" },
+	{ 16, 512, "6.3" },
+	{ 17, 544, "7.1" },
+	{ 18, 576, "8.0" },
+};
+
+const ShutterSpeed shutter_speeds_table[] = {
+	{ -12, -384, "15", 15000000 },
+	{ -11, -352, "13", 13000000 },
+	{ -10, -320, "10", 10000000 },
+	{  -9, -288, "8",   8000000 },
+	{  -8, -256, "6",   6000000 },
+	{  -7, -224, "5",   5000000 },
+	{  -6, -192, "4",   4000000 },
+	{  -5, -160, "3.2", 3200000 },
+	{  -4, -128, "2.5", 2500000 },
+	{  -3,  -96, "2",   2000000 },
+	{  -2,  -64, "1.6", 1600000 },
+	{  -1,  -32, "1.3", 1300000 },
+	{   0,    0, "1",   1000000 },
+	{   1,   32, "0.8",  800000 },
+	{   2,   64, "0.6",  600000 },
+	{   3,   96, "0.5",  500000 },
+	{   4,  128, "0.4",  400000 },
+	{   5,  160, "0.3",  300000 },
+	{   6,  192, "1/4",  250000 },
+	{   7,  224, "1/5",  200000 },
+	{   8,  256, "1/6",  166667 },
+	{   9,  288, "1/8",  125000 },
+	{  10,  320, "1/10", 100000 },
+	{  11,  352, "1/13",  76923 },
+	{  12,  384, "1/15",  66667 },
+	{  13,  416, "1/20",  50000 },
+	{  14,  448, "1/25",  40000 },
+	{  15,  480, "1/30",  33333 },
+	{  16,  512, "1/40",  25000 },
+	{  17,  544, "1/50",  20000 },
+	{  18,  576, "1/60",  16667 },
+	{  19,  608, "1/80",  12500 },
+	{  20,  640, "1/100", 10000 },
+	{  21,  672, "1/125",  8000 },
+	{  22,  704, "1/160",  6250 },
+	{  23,  736, "1/200",  5000 },
+	{  24,  768, "1/250",  4000 },
+	{  25,  800, "1/320",  3125 },
+	{  26,  832, "1/400",  2500 },
+	{  27,  864, "1/500",  2000 },
+	{  28,  896, "1/640",  1563 },
+	{  29,  928, "1/800",  1250 },
+	{  30,  960, "1/1000", 1000 },
+	{  31,  992, "1/1250",  800 },
+	{  32, 1021, "1/1600",  625 },
+	{  33, 1053, "1/2000",  500 },
+	{  34, 1084, "1/2500",  400 },
+	{  35, 1117, "1/3200",  313 },
+};
+
+const ISOTable iso_table[] = {
+	{ -1,    1,   "HI", -1},
+	{  0,    0, "Auto", -1},
+	{  1,   80,   "80", -1},
+	{  2,  100,  "100", -1},
+	{  3,  200,  "200", -1},
+	{  4,  400,  "400", -1},
+	{  5,  800,  "800", -1},
+	{  6, 1600, "1600", -1},
+	{  7, 3200, "3200", -1},
+};          
+
+#include "../generic/shooting.c"
+
+// dof_tbl copied from A720/A650, probably wrong though it doesn't look like it's used anywhere.
+const int dof_tbl[] = {5800, 6420, 7060, 7700, 8340, 9950, 11550, 13160, 14750, 17150, 19570, 22760, 26750, 30750, 34800};
+const int dof_tbl_size = sizeof(dof_tbl)/sizeof(dof_tbl[0]);
+
+long get_file_next_counter() {
+	return get_file_counter();
+}
+
+long get_target_file_num() {
+	long n;
+	
+	n = get_file_next_counter();
+	n = (n>>4)&0x3FFF;
+	return n;
+}
+
+long get_target_dir_num() {
+	long n;
+	
+	n = get_file_next_counter();
+	n = (n>>18)&0x3FF;
+	return n;
+}
+
+int circle_of_confusion = 5;
Index: /trunk/platform/s5is/Makefile
===================================================================
--- /trunk/platform/s5is/Makefile	(revision 511)
+++ /trunk/platform/s5is/Makefile	(revision 511)
@@ -0,0 +1,25 @@
+curdir=./
+topdir=../../
+
+include $(topdir)makefile.inc
+
+CFLAGS+=-DLOW_LEVEL
+
+SUBDIRS=sub
+
+all: all-recursive libplatform.a
+
+OBJS=main.o lib.o wrappers.o kbd.o shooting.o
+# stubs_init.o
+
+kbd.o: kbd.c
+lib.o: lib.c
+main.o: main.c
+shooting.o: shooting.c ../generic/shooting.c
+wrappers.o: wrappers.c ../generic/wrappers.c
+
+libplatform.a: $(OBJS)
+
+clean: clean-recursive
+	rm -f $(OBJS) libplatform.a
+
Index: /trunk/platform/ixus70_sd1000/kbd.c
===================================================================
--- /trunk/platform/ixus70_sd1000/kbd.c	(revision 511)
+++ /trunk/platform/ixus70_sd1000/kbd.c	(revision 511)
@@ -0,0 +1,473 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "conf.h"
+#include "core.h"
+#include "keyboard.h"
+
+typedef struct {
+	short grp;
+	long hackkey;
+	long canonkey;
+} KeyMap;
+
+
+static long kbd_new_state[3];
+static long kbd_prev_state[3];
+static long kbd_mod_state[3];
+static KeyMap keymap[];
+static long last_kbd_key = 0;
+static int usb_power=0;
+static int remote_key, remote_count;
+static int shoot_counter=0;
+#define DELAY_TIMEOUT 10000
+#define USB_MASK (0x40000) 
+#define USB_REG 2
+
+
+#define KEYS_MASK0 (0x00000000)
+#define KEYS_MASK1 (0xc0000000) // (0xc0800000)
+#define KEYS_MASK2 (0x0ffc)
+
+#define NEW_SS (0x2000)
+#define SD_READONLY_FLAG (0x20000)
+
+#ifndef MALLOCD_STACK
+static char kbd_stack[NEW_SS];
+#endif
+
+long __attribute__((naked)) wrap_kbd_p1_f() ;
+
+void wait_until_remote_button_is_released(void)
+{
+int count1;
+int count2;
+int tick,tick2,tick3;
+int nSW;
+int prev_usb_power,cur_usb_power;
+ // ------ add by Masuji SUTO (start) --------------
+    static int nMode;
+ // ------ add by Masuji SUTO (end)   --------------
+
+asm volatile ("STMFD SP!, {R0-R11,LR}\n"); // store R0-R11 and LR in stack
+
+debug_led(1);
+tick = get_tick_count();
+tick2 = tick;
+static long usb_physw[3];
+                                        
+ if (conf.synch_enable && conf.ricoh_ca1_mode && conf.remote_enable && (!shooting_get_drive_mode()|| (shooting_get_drive_mode()==1) || ((shooting_get_drive_mode()==2) && state_shooting_progress != SHOOTING_PROGRESS_PROCESSING))) // synch mode enable so wait for USB to disconnect
+  {
+// ------ add by Masuji SUTO (start) --------------
+        nMode=0;
+        usb_physw[2] = 0;                                             // makes sure USB bit is cleared.
+        _kbd_read_keys_r2(usb_physw);
+        if((usb_physw[2] & USB_MASK)==USB_MASK) nMode=1;
+// ------ add by Masuji SUTO (end)   --------------
+
+if(conf.ricoh_ca1_mode && conf.remote_enable)
+{
+	if(shooting_get_drive_mode()==1 && state_shooting_progress == SHOOTING_PROGRESS_PROCESSING){			//continuous-shooting mode
+		if(conf.bracket_type>2){
+			if(shoot_counter<2) shutter_int=3;
+			shoot_counter--;
+			}
+		else{
+			prev_usb_power=0;
+			nSW = 0;
+			do
+				{     
+				usb_physw[2] = 0;                                             // makes sure USB bit is cleared.
+				_kbd_read_keys_r2(usb_physw);
+				cur_usb_power = (usb_physw[2] & USB_MASK)==USB_MASK;
+				if(cur_usb_power){
+					if(!prev_usb_power){
+						tick2 = get_tick_count();
+						prev_usb_power=cur_usb_power;
+						}
+					else{
+						if((int)get_tick_count()-tick2>1000) {debug_led(0);}
+						}
+					}
+				else{
+					if(prev_usb_power){
+						tick3 = (int)get_tick_count()-tick2;
+						if(nSW==10) {
+							if(tick3>50) shutter_int=1;
+							nSW=20;
+							}
+						if(nSW==0 && tick3>0) {
+							if(tick3<50) {
+							nSW=10;
+							}
+						else{
+							if(tick3>1000) shutter_int=1;
+								nSW=20;
+							}
+						}
+						prev_usb_power=cur_usb_power;
+						}
+					}
+				if((int)get_tick_count()-tick >= DELAY_TIMEOUT) {nSW=20;shutter_int=2;}
+				}
+			 while(nSW<20);
+			 }
+		} 		//continuous-shooting mode 
+		else{		//nomal mode 
+			shoot_counter=0;
+			if(conf.bracket_type>2){
+				shoot_counter=(conf.bracket_type-2)*2;
+				}
+   do
+         {     
+            usb_physw[2] = 0;                                             // makes sure USB bit is cleared.
+           _kbd_read_keys_r2(usb_physw);
+           }
+//   while(((usb_physw[2] & USB_MASK)==USB_MASK) && ((int)get_tick_count()-tick < DELAY_TIMEOUT));
+// ------ modif by Masuji SUTO (start) --------------
+        while(((((usb_physw[2] & USB_MASK)!=USB_MASK) && (nMode==0)) || (((usb_physw[2] & USB_MASK)==USB_MASK) && (nMode==1))) && ((int)get_tick_count()-tick < DELAY_TIMEOUT));
+// ------ modif by Masuji SUTO (end)   --------------
+ }
+ }
+
+else
+   {
+
+      do
+          {
+            usb_physw[2] = 0;                                             // makes sure USB bit is cleared.
+           _kbd_read_keys_r2(usb_physw);
+             
+           }
+        while((usb_physw[2]&USB_MASK) &&  ((int)get_tick_count()-tick < DELAY_TIMEOUT));
+    }
+
+  }
+
+if (conf.synch_delay_enable && conf.synch_delay_value>0)                                // if delay is switched on and greater than 0
+  {
+    for (count1=0;count1<conf.synch_delay_value+(conf.synch_delay_coarse_value*1000);count1++) // wait delay_value * 0.1ms
+    {
+      for (count2=0;count2<1400;count2++)            // delay approx. 0.1ms
+        {
+        }
+     }
+  }
+
+debug_led(0);
+asm volatile ("LDMFD SP!, {R0-R11,LR}\n"); // restore R0-R11 and LR from stack
+}
+
+static void __attribute__((noinline)) mykbd_task_proceed()
+{
+    while (physw_run){
+	_SleepTask(10);
+
+	if (wrap_kbd_p1_f() == 1){ // autorepeat ?
+	    _kbd_p2_f();
+	}
+    }
+}
+
+void __attribute__((naked,noinline)) mykbd_task(long ua, long ub, long uc, long ud, long ue, long uf)
+{
+    /* WARNING
+     * Stack pointer manipulation performed here!
+     * This means (but not limited to):
+     *	function arguments destroyed;
+     *	function CAN NOT return properly;
+     *	MUST NOT call or use stack variables before stack
+     *	is setup properly;
+     *
+     */
+
+    register int i;
+    register long *newstack;
+
+#ifndef MALLOCD_STACK
+    newstack = (void*)kbd_stack;
+#else
+    newstack = malloc(NEW_SS);
+#endif
+
+    for (i=0;i<NEW_SS/4;i++)
+	newstack[i]=0xdededede;
+
+    asm volatile (
+	"MOV	SP, %0"
+	:: "r"(((char*)newstack)+NEW_SS)
+	: "memory"
+    );
+
+    mykbd_task_proceed();
+
+    /* function can be modified to restore SP here...
+     */
+
+    _ExitTask();
+}
+
+
+long __attribute__((naked,noinline)) wrap_kbd_p1_f()
+{
+
+    asm volatile(
+                "STMFD   SP!, {R4-R7,LR}\n"
+                "SUB     SP, SP, #0xC\n"
+                "BL      my_kbd_read_keys\n"
+		"B	 _kbd_p1_f_cont\n"
+    );
+    return 0; // shut up the compiler
+}
+
+
+void my_kbd_read_keys()
+{
+    kbd_prev_state[0] = kbd_new_state[0];
+    kbd_prev_state[1] = kbd_new_state[1];
+    kbd_prev_state[2] = kbd_new_state[2];
+    _kbd_pwr_on();
+    kbd_fetch_data(kbd_new_state);
+
+    if (kbd_process() == 0){
+	// leave it alone...
+	physw_status[0] = kbd_new_state[0];
+	physw_status[1] = kbd_new_state[1];
+	physw_status[2] = kbd_new_state[2];
+	//physw_status[1] |= alt_mode_key_mask;
+
+    } else {
+      // override keys
+        physw_status[0] = (kbd_new_state[0] & (~KEYS_MASK0)) |
+              (kbd_mod_state[0] & KEYS_MASK0);
+
+        physw_status[1] = (kbd_new_state[1] & (~KEYS_MASK1)) |
+              (kbd_mod_state[1] & KEYS_MASK1);
+
+        physw_status[2] = (kbd_new_state[2] & (~KEYS_MASK2)) |
+              (kbd_mod_state[2] & KEYS_MASK2);
+    }
+
+
+
+    _kbd_read_keys_r2(physw_status);
+
+		remote_key = (physw_status[2] & USB_MASK)==USB_MASK;
+		if (remote_key) 
+			remote_count += 1;
+		else if (remote_count) {
+			usb_power = remote_count;
+			remote_count = 0;
+		}
+	if (conf.remote_enable) {
+		physw_status[2] = physw_status[2] & ~(SD_READONLY_FLAG | USB_MASK);
+	}
+	else
+		physw_status[2] = physw_status[2] & ~SD_READONLY_FLAG;
+
+
+    _kbd_pwr_off();
+
+}
+
+int get_usb_power(int edge)
+{
+	int x;
+
+	if (edge) return remote_key;
+	x = usb_power;
+	usb_power = 0;
+	return x;
+}
+
+/* void kbd_set_alt_mode_key_mask(long key)
+{
+    int i;
+    for (i=0; keymap[i].hackkey; ++i) {
+	if (keymap[i].hackkey == key) {
+	    alt_mode_key_mask = keymap[i].canonkey;
+	    return;
+	}
+    }
+} */
+
+void kbd_key_press(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    kbd_mod_state[keymap[i].grp] &= ~keymap[i].canonkey;
+	    return;
+	}
+    }
+}
+
+void kbd_key_release(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    kbd_mod_state[keymap[i].grp] |= keymap[i].canonkey;
+	    return;
+	}
+    }
+}
+
+void kbd_key_release_all()
+{
+  kbd_mod_state[0] |= KEYS_MASK0;
+  kbd_mod_state[1] |= KEYS_MASK1;
+  kbd_mod_state[2] |= KEYS_MASK2;
+}
+
+long kbd_is_key_pressed(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    return ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0) ? 1:0;
+	}
+    }
+    return 0;
+}
+
+long kbd_is_key_clicked(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    return ((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
+		    ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0);
+	}
+    }
+    return 0;
+}
+
+long kbd_get_pressed_key()
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0){
+	    return keymap[i].hackkey;
+	}
+    }
+    return 0;
+}
+
+long kbd_get_clicked_key()
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
+	    ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0)){
+	    return keymap[i].hackkey;
+	}
+    }
+    return 0;
+}
+
+void kbd_reset_autoclicked_key() {
+    last_kbd_key = 0;
+}
+
+long kbd_get_autoclicked_key() {
+    static long last_kbd_time = 0, press_count = 0;
+    register long key, t;
+
+    key=kbd_get_clicked_key();
+    if (key) {
+        last_kbd_key = key;
+        press_count = 0;
+        last_kbd_time = get_tick_count();
+        return key;
+    } else {
+        if (last_kbd_key && kbd_is_key_pressed(last_kbd_key)) {
+            t = get_tick_count();
+            if (t-last_kbd_time>((press_count)?175:500)) {
+                ++press_count;
+                last_kbd_time = t;
+                return last_kbd_key;
+            } else {
+                return 0;
+            }
+        } else {
+            last_kbd_key = 0;
+            return 0;
+        }
+    }
+	
+	
+}
+
+long kbd_use_zoom_as_mf() { 
+    static long v;
+    static long zoom_key_pressed = 0;
+
+    if (kbd_is_key_pressed(KEY_ZOOM_IN) && (mode_get()&MODE_MASK) == MODE_REC) {
+        get_property_case(PROPCASE_FOCUS_MODE, &v, 4);
+        if (v) {
+            kbd_key_release_all();
+            kbd_key_press(KEY_RIGHT);
+            zoom_key_pressed = KEY_ZOOM_IN;
+            return 1;
+        }
+    } else {
+        if (zoom_key_pressed==KEY_ZOOM_IN) {
+            kbd_key_release(KEY_RIGHT);
+            zoom_key_pressed = 0;
+            return 1;
+        }
+    }
+    if (kbd_is_key_pressed(KEY_ZOOM_OUT) && (mode_get()&MODE_MASK) == MODE_REC) {
+        get_property_case(PROPCASE_FOCUS_MODE, &v, 4);
+        if (v) {
+            kbd_key_release_all();
+            kbd_key_press(KEY_LEFT);
+            zoom_key_pressed = KEY_ZOOM_OUT;
+            return 1;
+        }
+    } else {
+        if (zoom_key_pressed==KEY_ZOOM_OUT) {
+            kbd_key_release(KEY_LEFT);
+            zoom_key_pressed = 0;
+            return 1;
+        }
+    }
+    return 0;
+}
+
+
+
+static KeyMap keymap[] = {
+    /* tiny bug: key order matters. see kbd_get_pressed_key()
+     * for example
+     */
+	{2, KEY_UP	, 0x00000010 },
+	{2, KEY_DOWN	, 0x00000040 },
+	{2, KEY_LEFT	, 0x00000080 },
+	{2, KEY_RIGHT	, 0x00000020 },
+	{2, KEY_SET	, 0x00000100 },
+	{1, KEY_SHOOT_FULL, 0xC0000000 }, // note 3 here!
+	{1, KEY_SHOOT_HALF, 0x40000000 },
+	{2, KEY_ZOOM_IN	, 0x00000004 },
+	{2, KEY_ZOOM_OUT, 0x00000008 },
+	{2, KEY_MENU	, 0x00000200 },
+	{2, KEY_DISPLAY	, 0x00000400 },
+	{2, KEY_PRINT	, 0x00000800 },
+      //  {2, KEY_DUMMY	, 0x00000800 },
+	{ 0, 0 }
+};
+
+
+
+
+ void kbd_fetch_data(long *dst)
+{
+    volatile long *mmio0 = (void*)0xc0220200;
+    volatile long *mmio1 = (void*)0xc0220204;
+    volatile long *mmio2 = (void*)0xc0220208;
+
+    dst[0] = *mmio0;
+    dst[1] = *mmio1;
+    dst[2] = *mmio2 & 0xffff;
+}
+
Index: /trunk/platform/ixus70_sd1000/wrappers.c
===================================================================
--- /trunk/platform/ixus70_sd1000/wrappers.c	(revision 511)
+++ /trunk/platform/ixus70_sd1000/wrappers.c	(revision 511)
@@ -0,0 +1,16 @@
+#include "../generic/wrappers.c"
+
+long lens_get_focus_pos()
+{
+    return _GetFocusLensSubjectDistance();
+}
+
+long lens_get_focus_pos_from_lense()
+{
+    return _GetFocusLensSubjectDistanceFromLens();
+}
+
+long lens_get_target_distance()
+{
+    return _GetCurrentTargetDistance();
+}
Index: /trunk/platform/ixus70_sd1000/main.c
===================================================================
--- /trunk/platform/ixus70_sd1000/main.c	(revision 511)
+++ /trunk/platform/ixus70_sd1000/main.c	(revision 511)
@@ -0,0 +1,76 @@
+#include "../generic/main.c"
+
+long get_vbatt_min()
+{
+    return 3500;
+}
+
+long get_vbatt_max()
+{
+    return 4100;
+}
+
+static const int fl_tbl[] = {5800, 7109, 8462, 10093, 12120, 14421, 17400}; // exif for each zoom step
+#define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0]))
+#define CF_EFL 60345 // for 1/2,5" sensor (60345) for 1/1,8" sensor (47946)
+
+const int zoom_points = NUM_FL;
+
+int get_effective_focal_length(int zp) {
+    return (CF_EFL*get_focal_length(zp))/10000;
+}
+
+int get_focal_length(int zp) {
+    if (zp<0) return fl_tbl[0];
+    else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1];
+    else return fl_tbl[zp];
+}
+
+int get_zoom_x(int zp) {
+    if (zp<1) return 10;
+    else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0];
+    else return fl_tbl[zp]*10/fl_tbl[0];
+}
+
+static struct {
+	int hackmode;
+	int canonmode;
+} modemap[] = {
+    { MODE_AUTO,               32768 }, // PROPCACE 49
+//    { MODE_M,                  32772 },
+    { MODE_P,                  32772 },
+    { MODE_DIGITAL_MACRO,      33288 },
+    { MODE_PORTRAIT,           32781 },
+    { MODE_NIGHT_SNAPSHOT,     32779 },
+    { MODE_COLOR_ACCENT,       33306 }, //  { MODE_SCN_COLOR_ACCENT,   33306 },
+    { MODE_MY_COLORS,          33307 },
+    { MODE_SCN_KIDS_PETS,      16400 }, //  { MODE_SCN_CHILD,          16400 },
+    { MODE_SCN_INDOOR,         16401 }, //  { MODE_SCN_PARTY,          16401 },
+    { MODE_SCN_FOLIAGE,        16402 }, //  { MODE_SCN_GRASS,          16402 },
+    { MODE_SCN_SNOW,           16403 },
+    { MODE_SCN_BEACH,          16404 },
+    { MODE_SCN_FIREWORK,       16405 },
+    { MODE_SCN_AQUARIUM,       16407 },
+    { MODE_SCN_WATER,          16406 },
+    { MODE_VIDEO_STD,          2597  },
+    { MODE_VIDEO_SPEED,        2598  },
+    { MODE_VIDEO_COMPACT,      2599  },
+    { MODE_VIDEO_COLOR_ACCENT, 2595  },
+    { MODE_VIDEO_MY_COLORS,    2596  },
+    { MODE_VIDEO_TIME_LAPSE,   2601  },
+    { MODE_STITCH,             33290 },
+};
+#define MODESCNT (sizeof(modemap)/sizeof(modemap[0]))
+
+int mode_get() {
+    int mode, i, t=0xFF;
+
+    mode  = (physw_status[2] & 0x4000)?MODE_REC:MODE_PLAY;    
+    _GetPropertyCase(PROPCASE_SHOOTING_MODE, &t, 4);
+    for (i=0; i<MODESCNT; ++i) {
+	if (modemap[i].canonmode == t) {
+	    return (mode | (modemap[i].hackmode & MODE_SHOOTING_MASK));
+	}
+    }
+    return (mode);
+}
Index: /trunk/platform/ixus70_sd1000/notes.txt
===================================================================
--- /trunk/platform/ixus70_sd1000/notes.txt	(revision 511)
+++ /trunk/platform/ixus70_sd1000/notes.txt	(revision 511)
@@ -0,0 +1,12 @@
+****************************************
+
+Camera depending notes: 
+
+- ixus70_sd1000 uses Propset 2 of Properties (see http://tinyurl.com/6zbv9b)
+- ixus70_sd1000 does NOT have a real IRIS Diaphragm, it only has an ND Filter! 
+Mind this.
+- CHDK for firmware 1.01a is the SAME for 1.01b
+
+
+
+
Index: /trunk/platform/ixus70_sd1000/lib.c
===================================================================
--- /trunk/platform/ixus70_sd1000/lib.c	(revision 511)
+++ /trunk/platform/ixus70_sd1000/lib.c	(revision 511)
@@ -0,0 +1,56 @@
+#include "platform.h"
+
+//define LED_AF    0xc02200C0 // found in "taskcreate_LEDCon"
+//define LED_BLUE  0xc02200C4
+//define LED_RED   0xc02200C8
+//define LED_GRN   0xc02200CC
+//define LED_YLW   0xc02200D0
+//define LED_PWR   0xc02200D4
+
+void shutdown()
+{
+    volatile long *p = (void*)0xC02200A0;
+        
+    asm(
+         "MRS     R1, CPSR\n"
+         "AND     R0, R1, #0x80\n"
+         "ORR     R1, R1, #0x80\n"
+         "MSR     CPSR_cf, R1\n"
+         :::"r1","r0");
+        
+    *p = 0x44;
+
+    while(1);
+}
+
+
+#define LED_PR 0xc02200C4
+
+void debug_led(int state)
+{
+    volatile long *p=(void*)LED_PR;
+    if (state)
+	p[0]=0x46;
+    else
+	p[0]=0x44;
+}
+
+
+int get_flash_params_count(void){
+ return 111;
+}
+
+#define LED_BASE 0xC02200C0
+
+void ubasic_set_led(int led, int state, int bright)
+
+{
+  int leds[] = {12,16,4,8,4,0,4};
+  if(led < 4 || led > 10 || led == 6) return;
+  volatile long *p=(void*)LED_BASE + leds[led-4];
+    if (state)
+	p[0]=0x46;
+    else
+	p[0]=0x44;
+}
+
Index: /trunk/platform/ixus70_sd1000/sub/100c/capt_seq.c
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/100c/capt_seq.c	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/100c/capt_seq.c	(revision 511)
@@ -0,0 +1,295 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+#define RAWDATA_AVAILABLE (1)
+#define RAWDATA_SAVED (2)
+
+#define NR_ON (2)
+#define NR_OFF (1)
+
+static long raw_save_stage;
+
+void capt_seq_hook_raw_here()
+{
+    raw_save_stage = RAWDATA_AVAILABLE;
+    core_rawdata_available();
+    while (raw_save_stage != RAWDATA_SAVED){
+	_SleepTask(10);
+    }
+}
+
+void hook_raw_save_complete()
+{
+    raw_save_stage = RAWDATA_SAVED;
+}
+
+
+void capt_seq_hook_set_nr()
+{
+    long *nrflag = (long*)0xCDA0;
+
+    switch (core_get_noise_reduction_value()){
+    case NOISE_REDUCTION_AUTO_CANON:
+	// leave it alone
+	break;
+    case NOISE_REDUCTION_OFF:
+	*nrflag = 1;
+	break;
+    case NOISE_REDUCTION_ON:
+	*nrflag = 2;
+	break;
+    };
+}
+
+
+void __attribute__((naked,noinline)) sub_FFB01DBC_my(long p)
+{
+    asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                "MOV     R4, R0\n"
+                "SUB     SP, SP, #0xC\n"
+                "BL      sub_FFB0282C\n"
+//              "MOVL    R1, 0xFFFFFFFF\n"
+                "MVN     R1, #0\n"
+                "BL      sub_FFB12F9C\n" //ClearEventFlag
+                "MOV     R0, #0x8A\n"
+                "ADD     R1, SP, #4\n"
+                "MOV     R2, #4\n"
+                "BL      sub_FF81BC98\n"
+                "TST     R0, #1\n"
+                "BEQ     loc_FFB01DFC\n"
+                "MOV     R1, #0x1D0\n"
+                "LDR     R0, =0xFFB01C40\n" //aSscaptureseq_c
+                "ADD     R1, R1, #2\n"
+                "BL      sub_FFB20628\n" //DebugAssert
+"loc_FFB01DFC:\n"                           
+                "LDR     R3, =0xBDA80\n"
+                "LDR     R2, =0xBDB40\n"
+                "LDR     R0, [R3,#0x7C]\n"
+                "LDRSH   R1, [R2,#0xE]\n"
+                "BL      sub_FFA3957C\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FFB01BC4\n"
+                "BL      wait_until_remote_button_is_released\n"
+                "BL      capt_seq_hook_set_nr\n" // +
+                "LDR     R3, =0xCDA4\n"
+                "LDR     R0, [R3]\n"
+
+                "B       sub_FFB01E20\n"  // ---> jump to end of function in ROM
+    );
+}
+
+void __attribute__((naked,noinline)) sub_FFAFEBE4_my(long p)
+{
+    asm volatile (
+                "STMFD   SP!, {R4,R5,LR}\n"
+                "LDR     R3, =0xBDA80\n"
+                "LDR     R5, [R0,#0xC]\n"
+                "LDR     R1, [R3,#0x24]\n"
+                "LDR     R2, [R5,#8]\n"
+                "CMP     R1, #0\n"
+                "ORR     R2, R2, #1\n"
+                "STR     R2, [R5,#8]\n"
+                "BNE     loc_FFAFEC38\n"
+                "MOV     R0, #0xC\n"
+                "BL      sub_FFB09134\n"
+                "TST     R0, #1\n"
+                "BEQ     loc_FFAFEC38\n"
+                "LDR     R3, [R5,#8]\n"
+                "MOV     R0, #1\n"
+                "ORR     R3, R3, #0x40000000\n"
+                "STR     R3, [R5,#8]\n"
+"loc_FFAFEC28:\n"                           
+                "MOV     R2, R5\n"
+                "MOV     R1, #1\n"
+                "LDMFD   SP!, {R4,R5,LR}\n"
+                "B       sub_FFAFD38C\n"
+ "loc_FFAFEC38:\n"                           
+                "LDR     R4, =0xBDA80\n"
+                "BL      sub_FFAFF6DC\n" //Set_CMD25Write_61
+                "LDR     R3, [R4,#0x24]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FFAFEC80\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FFB008C0\n"
+                "TST     R0, #1\n"
+                "BNE     loc_FFAFEC28\n"
+                "BL      sub_FF8261B8\n"
+                "BL      sub_FF81BE94\n"
+                "STR     R0, [R5,#0x14]\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FFB01CA4\n"
+                "BL      sub_FFB02698\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FFB01DBC_my\n"  //---------->
+                "BL      capt_seq_hook_raw_here\n"  // +
+                "B       loc_FFAFEC94\n"
+"loc_FFAFEC80:\n"
+                "LDR     R3, =0xCD8C\n"
+                "LDR     R2, [R3]\n"
+                "CMP     R2, #0\n"
+                "MOVNE   R0, #0x1D\n"
+                "MOVEQ   R0, #0\n"
+"loc_FFAFEC94:\n"
+                "MOV     R1, #1\n"
+                "MOV     R2, R5\n"
+                "BL      sub_FFAFD38C\n"
+                "BL      sub_FFB02138\n"
+                "CMP     R0, #0\n"
+                "LDRNE   R3, [R5,#8]\n"
+                "ORRNE   R3, R3, #0x2000\n"
+                "STRNE   R3, [R5,#8]\n"
+                "LDMFD   SP!, {R4,R5,PC}\n"
+    );
+}
+
+void __attribute__((naked,noinline)) capt_seq_task()
+{
+	asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                "SUB     SP, SP, #4\n"
+                "MOV     R4, SP\n"
+                "B       loc_FFAFF21C\n"
+"loc_FFAFF0A0:\n"                           
+                "LDR     R2, [SP]\n"
+                "LDR     R3, [R2]\n"
+                "MOV     R0, R2\n"
+                "CMP     R3, #0x15\n"
+                "LDRLS   PC, [PC,R3,LSL#2]\n"
+                "B       loc_FFAFF1F0\n"
+                ".long loc_FFAFF110\n"
+                ".long loc_FFAFF130\n"
+                ".long loc_FFAFF144\n"
+                ".long loc_FFAFF158\n"
+                ".long loc_FFAFF150\n"
+                ".long loc_FFAFF160\n"
+                ".long loc_FFAFF168\n"
+                ".long loc_FFAFF174\n"
+                ".long loc_FFAFF17C\n"
+                ".long loc_FFAFF188\n"
+                ".long loc_FFAFF190\n"
+                ".long loc_FFAFF198\n"
+                ".long loc_FFAFF1A0\n"
+                ".long loc_FFAFF1A8\n"
+                ".long loc_FFAFF1B0\n"
+                ".long loc_FFAFF1BC\n"
+                ".long loc_FFAFF1C4\n"
+                ".long loc_FFAFF1CC\n"
+                ".long loc_FFAFF1D4\n"
+                ".long loc_FFAFF1E0\n"
+                ".long loc_FFAFF1E8\n"
+                ".long loc_FFAFF204\n"
+"loc_FFAFF110:\n"                           
+                                        
+                "BL      sub_FFAFF704\n"
+                "BL      shooting_expo_param_override\n"   // +
+                "BL      sub_FFAFCE14\n"
+                "LDR     R3, =0xBDA80\n"
+                "LDR     R2, [R3,#0x24]\n"
+                "CMP     R2, #0\n"
+                "BEQ     loc_FFAFF200\n"
+                "BL      sub_FFAFECC0\n"
+                "B       loc_FFAFF200\n"
+"loc_FFAFF130:\n"                           
+                                        
+                "BL      sub_FFAFEBE4_my\n"  //--------->
+
+"loc_FFAFF134:\n"                           
+                "LDR     R2, =0xBDA80\n"                       
+                "MOV     R3, #0\n"
+                "STR     R3, [R2,#0x24]\n"
+                "B       loc_FFAFF200\n"
+"loc_FFAFF144:\n"                           
+                "MOV     R0, #1\n"                        
+                "BL      sub_FFAFF924\n" //jumptable case 2
+                "B       loc_FFAFF200\n"
+"loc_FFAFF150:\n"                           
+                "BL      sub_FFAFF304\n" //jumptable case 4
+                "B       loc_FFAFF134\n"
+"loc_FFAFF158:\n"                           
+                "BL      sub_FFAFF6BC\n" //BackLightDrv_LcdBackLightOff_15
+                "B       loc_FFAFF134\n"
+"loc_FFAFF160:\n"                           
+                "BL      sub_FFAFF6CC\n" //jumptable case 5
+                "B       loc_FFAFF200\n"
+"loc_FFAFF168:\n"                           
+                "BL      sub_FFAFF81C\n" //jumptable case 6                        
+                "BL      sub_FFAFCE14\n"
+                "B       loc_FFAFF200\n"
+"loc_FFAFF174:\n"                           
+                "BL      sub_FFAFED9C\n" //jumptable case 7
+                "B       loc_FFAFF200\n"
+"loc_FFAFF17C:\n"                           
+                "BL      sub_FFAFF88C\n" //jumptable case 8                        
+                "BL      sub_FFAFCE14\n"
+                "B       loc_FFAFF200\n"
+"loc_FFAFF188:\n"                           
+                "BL      sub_FFAFF6BC\n" //BackLightDrv_LcdBackLightOff_15
+                "B       loc_FFAFF200\n"
+"loc_FFAFF190:\n"                           
+                "BL      sub_FFB00FF4\n" //jumptable case 10
+                "B       loc_FFAFF200\n"
+"loc_FFAFF198:\n"                           
+                "BL      sub_FFB011C8\n" //jumptable case 11
+                "B       loc_FFAFF200\n"
+"loc_FFAFF1A0:\n"                           
+                "BL      sub_FFB0125C\n" //jumptable case 12
+                "B       loc_FFAFF200\n"
+"loc_FFAFF1A8:\n"                           
+                "BL      sub_FFB01358\n" //jumptable case 13
+                "B       loc_FFAFF200\n"
+"loc_FFAFF1B0:\n"                           
+                "MOV     R0, #0\n"                        
+                "BL      sub_FFB015C4\n" //jumptable case 14
+                "B       loc_FFAFF200\n"
+"loc_FFAFF1BC:\n"                           
+                "BL      sub_FFB01798\n" //jumptable case 15
+                "B       loc_FFAFF200\n"
+"loc_FFAFF1C4:\n"                           
+                "BL      sub_FFB01834\n" //jumptable case 16
+                "B       loc_FFAFF200\n"
+"loc_FFAFF1CC:\n"                           
+                "BL      sub_FFB018F4\n" //jumptable case 17
+                "B       loc_FFAFF200\n"
+"loc_FFAFF1D4:\n"                           
+                "BL      sub_FFAFFA78\n" //jumptable case 18                        
+                "BL      sub_FFAFEB08\n"
+                "B       loc_FFAFF200\n"
+"loc_FFAFF1E0:\n"                           
+                "BL      sub_FFB01498\n" //jumptable case 19
+                "B       loc_FFAFF200\n"
+"loc_FFAFF1E8:\n" 
+                "BL      sub_FFB014F4\n" //jumptable case 20
+                "B       loc_FFAFF200\n"
+"loc_FFAFF1F0:\n"                         
+                "MOV     R1, #0x4C0\n"
+                "LDR     R0, =0xFFAFE964\n" //aSsshoottask_c
+                "ADD     R1, R1, #0xE\n"
+                "BL      sub_FFB20628\n" //DebugAssert
+"loc_FFAFF200:\n"                           
+                "LDR     R2, [SP]\n"
+"loc_FFAFF204:\n"                           
+                "LDR     R3, =0x97348\n" //jumptable case 21
+                "LDR     R1, [R2,#4]\n"
+                "LDR     R0, [R3]\n"
+                "BL      sub_FFB12E00\n" //SetEventFlag
+                "LDR     R0, [SP]\n"
+                "BL      sub_FFAFE9E4\n"
+"loc_FFAFF21C:\n"                           
+                "LDR     R3, =0x9734C\n"
+                "MOV     R1, R4\n"
+                "LDR     R0, [R3]\n"
+                "MOV     R2, #0\n"
+                "BL      sub_FFB13518\n" //ReceiveMessageQueue
+                "TST     R0, #1\n"
+                "BEQ     loc_FFAFF0A0\n"
+                "LDR     R0, =0xFFAFE964\n" //aSsshoottask_c
+                "MOV     R1, #0x400\n"
+                "BL      sub_FFB20628\n" //DebugAssert
+                "BL      sub_FFB14ADC\n"
+                "ADD     SP, SP, #4\n"
+                "LDMFD   SP!, {R4,PC}\n"
+	);
+}
+
Index: /trunk/platform/ixus70_sd1000/sub/100c/stubs_entry.S
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/100c/stubs_entry.S	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/100c/stubs_entry.S	(revision 511)
@@ -0,0 +1,183 @@
+// !!! THIS FILE IS GENERATED. DO NOT EDIT. !!!
+#include "stubs_asm.h"
+
+// Best match: 95%
+NSTUB(AllocateMemory, 0xff811e34)
+// ALT: NSTUB(AllocateMemory, 0xff811e34) // 23/1
+NSTUB(AllocateUncacheableMemory, 0xff81e5a4)
+// ERROR: Close is not found!
+// Best match: 93%
+NSTUB(CreatePhysicalVram, 0xffa25d98)
+NSTUB(CreateTask, 0xffb1471c)
+NSTUB(CreateTaskStrict, 0xffb157bc)
+NSTUB(DisableDispatch, 0xffb14540)
+// ERROR: DisplayImagePhysicalScreen is not found!
+NSTUB(EnableDispatch, 0xffb145cc)
+NSTUB(ExecuteEventProcedure, 0xff814a58)
+NSTUB(ExitTask, 0xffb14adc)
+NSTUB(Fclose_Fut, 0xffa956dc)
+NSTUB(Fopen_Fut, 0xffa9569c)
+NSTUB(Fread_Fut, 0xffa95798)
+// Best match: 95%
+NSTUB(FreeMemory, 0xff811e40)
+// ALT: NSTUB(FreeMemory, 0xff811e40) // 23/1
+// Best match: 90%
+NSTUB(FreeUncacheableMemory, 0xff81e5d8)
+NSTUB(Fseek_Fut, 0xffa9588c)
+NSTUB(Fwrite_Fut, 0xffa957ec)
+NSTUB(GetCurrentAvValue, 0xffa501f4)
+// ALT: NSTUB(GetCurrentAvValue, 0xffa527c4) // 13/0
+NSTUB(GetCurrentTargetDistance, 0xffa5276c)
+// Best match: 90%
+NSTUB(GetFocusLensSubjectDistance, 0xffad2f40)
+// ALT: NSTUB(GetFocusLensSubjectDistance, 0xffad2f40) // 28/3
+NSTUB(GetFocusLensSubjectDistanceFromLens, 0xffad3434)
+// Best match: 86%
+NSTUB(GetParameterData, 0xffb39bec)
+// Best match: 89%
+NSTUB(GetPropertyCase, 0xff81bc98)
+// Best match: 96%
+NSTUB(GetSystemTime, 0xff8136ec)
+// ALT: NSTUB(GetSystemTime, 0xff8136ec) // 26/1
+// Best match: 68%
+NSTUB(GetZoomLensCurrentPoint, 0xffae5e70)
+// ALT: NSTUB(GetZoomLensCurrentPoint, 0xffae5e70) // 20/9
+// Best match: 51%
+NSTUB(GetZoomLensCurrentPosition, 0xffae5e84)
+// ALT: NSTUB(GetZoomLensCurrentPosition, 0xffae5e84) // 15/14
+NSTUB(IsStrobeChargeCompleted, 0xff9a43a8)
+NSTUB(LockMainPower, 0xffb36b00)
+// Best match: 61%
+NSTUB(MakeDirectory, 0xffa9a2c4)
+// ERROR: Mount_FileSystem is not found!
+// Best match: 73%
+NSTUB(MoveFocusLensToDistance, 0xffa52a04)
+NSTUB(MoveZoomLensWithPoint, 0xffae5d48)
+// ALT: NSTUB(MoveZoomLensWithPoint, 0xffae5d48) // 25/0
+// Best match: 66%
+NSTUB(Open, 0xffa99f6c)
+// Best match: 93%
+NSTUB(PhySw_testgpio, 0xffa30c70)
+NSTUB(ProtectFile, 0xffa94bc0)
+// Best match: 92%
+NSTUB(PutInNdFilter, 0xffa503d8)
+// ALT: NSTUB(PutInNdFilter, 0xffa503d8) // 25/2
+// Best match: 94%
+NSTUB(PutOutNdFilter, 0xffa50420)
+// ALT: NSTUB(PutOutNdFilter, 0xffa50420) // 16/1
+// ERROR: Read is not found!
+// Best match: 58%
+NSTUB(RefreshPhysicalScreen, 0xff90bc18)
+// ERROR: Remove is not found!
+NSTUB(SetAutoShutdownTime, 0xffb36a04)
+// Best match: 86%
+NSTUB(SetParameterData, 0xffb39b0c)
+// Best match: 73%
+NSTUB(SetPropertyCase, 0xff81bb5c)
+NSTUB(SleepTask, 0xffb14630)
+// Best match: 61%
+NSTUB(TakeSemaphore, 0xffb140e8)
+NSTUB(UnlockMainPower, 0xffb36b98)
+NSTUB(Unmount_FileSystem, 0xffa99360)
+// Best match: 89%
+NSTUB(UnsetZoomForMovie, 0xff834a74)
+NSTUB(UpdateMBROnFlash, 0xffa994b4)
+// Best match: 96%
+NSTUB(VbattGet, 0xffa2cc64)
+// ERROR: Write is not found!
+NSTUB(_log, 0xff912db4)
+// ALT: NSTUB(_log, 0xff912db4) // 27/0
+NSTUB(_log10, 0xff90fb5c)
+// ALT: NSTUB(_log10, 0xff90fb5c) // 27/0
+NSTUB(_pow, 0xff90fcdc)
+// ALT: NSTUB(_pow, 0xff90fcdc) // 25/0
+NSTUB(_sqrt, 0xff911b9c)
+// ALT: NSTUB(_sqrt, 0xff911b9c) // 24/0
+NSTUB(chdir, 0xff91d840)
+// ALT: NSTUB(chdir, 0xff91d840) // 27/0
+NSTUB(close, 0xff91d180)
+NSTUB(closedir, 0xffb525cc)
+// ERROR: free is not found!
+NSTUB(ints_disable, 0xffb127cc)
+NSTUB(ints_enable, 0xffb127d8)
+NSTUB(ioctl, 0xff91d2c0)
+NSTUB(iosDevAdd, 0xff91e3a0)
+NSTUB(iosDrvInstall, 0xff91e664)
+NSTUB(isalpha, 0xff914758)
+// ALT: NSTUB(isalpha, 0xff914758) // 4/0
+NSTUB(isdigit, 0xff914788)
+// ALT: NSTUB(isdigit, 0xff914788) // 4/0
+NSTUB(islower, 0xff9147b8)
+// ALT: NSTUB(islower, 0xff9147b8) // 4/0
+NSTUB(isspace, 0xff914800)
+// ALT: NSTUB(isspace, 0xff914800) // 4/0
+NSTUB(isupper, 0xff914818)
+// ALT: NSTUB(isupper, 0xff914818) // 4/0
+NSTUB(kbd_p1_f, 0xffa2f178)
+NSTUB(kbd_p1_f_cont, 0xffa2f184)
+// Best match: 56%
+NSTUB(kbd_p2_f, 0xffa2f5a8)
+// Best match: 83%
+NSTUB(kbd_pwr_off, 0xffa2e490)
+// ALT: NSTUB(kbd_pwr_off, 0xffa2e4ac) // 5/1
+// ALT: NSTUB(kbd_pwr_off, 0xffa30c2c) // 5/1
+// ALT: NSTUB(kbd_pwr_off, 0xffa30c48) // 5/1
+// Best match: 55%
+NSTUB(kbd_pwr_on, 0xffa275d4)
+// ALT: NSTUB(kbd_pwr_on, 0xffa27600) // 5/4
+// ALT: NSTUB(kbd_pwr_on, 0xffa27b00) // 5/4
+// ERROR: kbd_read_keys_r2 is not found!
+// Best match: 93%
+NSTUB(localtime, 0xff918fd8)
+NSTUB(lseek, 0xff91d2c4)
+// Best match: 53%
+NSTUB(malloc, 0xff9201c0)
+// ALT: NSTUB(malloc, 0xff9201c0) // 15/13
+NSTUB(memcmp, 0xff9183b8)
+// ALT: NSTUB(memcmp, 0xff924380) // 9/0
+NSTUB(memcpy, 0xff9183f4)
+NSTUB(memset, 0xff91846c)
+// Best match: 51%
+NSTUB(mkdir, 0xffa9a1fc)
+// ALT: NSTUB(mkdir, 0xffa9a2d0) // 16/15
+NSTUB(open, 0xff91d7c4)
+NSTUB(opendir, 0xffb52600)
+NSTUB(qsort, 0xff917c18)
+NSTUB(rand, 0xff917c3c)
+// ALT: NSTUB(rand, 0xff917c3c) // 8/0
+NSTUB(read, 0xff91d1e0)
+NSTUB(readdir, 0xffb52598)
+NSTUB(rename, 0xff91d7cc)
+// ALT: NSTUB(rename, 0xff91d7cc) // 26/0
+NSTUB(rewinddir, 0xffb525c0)
+NSTUB(srand, 0xff917c60)
+// ALT: NSTUB(srand, 0xff917c60) // 4/0
+NSTUB(stat, 0xffb52694)
+NSTUB(strcat, 0xff91848c)
+NSTUB(strchr, 0xff9184b8)
+NSTUB(strcmp, 0xff9184dc)
+NSTUB(strcpy, 0xff918670)
+NSTUB(strlen, 0xff9187d4)
+NSTUB(strncmp, 0xff918838)
+NSTUB(strncpy, 0xff91887c)
+// ALT: NSTUB(strncpy, 0xff91887c) // 24/0
+NSTUB(strpbrk, 0xff9188c4)
+NSTUB(strrchr, 0xff918900)
+// ALT: NSTUB(strrchr, 0xff918900) // 8/0
+NSTUB(strtol, 0xff918054)
+NSTUB(taskCreateHookAdd, 0xff922e20)
+NSTUB(taskDeleteHookAdd, 0xff922d5c)
+// Best match: 82%
+NSTUB(taskIdListGet, 0xff92a308)
+NSTUB(taskLock, 0xff92a9c4)
+NSTUB(taskName, 0xff92a200)
+NSTUB(taskResume, 0xff92a5e4)
+NSTUB(taskSuspend, 0xff92a410)
+NSTUB(taskUnlock, 0xff92aa6c)
+NSTUB(time, 0xff919d24)
+// ALT: NSTUB(time, 0xff919d24) // 25/0
+// Best match: 57%
+NSTUB(utime, 0xffb52728)
+// ALT: NSTUB(utime, 0xffb52728) // 15/11
+NSTUB(vsprintf, 0xff91bf28)
+NSTUB(write, 0xff91d250)
Index: /trunk/platform/ixus70_sd1000/sub/100c/stubs_entry_2.S
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/100c/stubs_entry_2.S	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/100c/stubs_entry_2.S	(revision 511)
@@ -0,0 +1,35 @@
+#include "stubs_asm.h"
+
+NHSTUB(Close,  0xFFA99F94)
+NHSTUB(DisplayImagePhysicalScreen, 0xFFA24FF4)
+NHSTUB(Mount_FileSystem, 0xFFA992B8)
+NHSTUB(Read,   0xFFA9A028)
+NHSTUB(Remove, 0xFFA99FB4)
+NHSTUB(Write,  0xFFA9A034)
+NHSTUB(free, 0xFF9201CC)
+NHSTUB(kbd_read_keys_r2, 0xFFA306B0)
+
+NSTUB(GetCurrentAvValue, 0xFFAD9E20)
+
+NHSTUB(AllocateMemory, 0xFF818664)
+NHSTUB(FreeMemory, 0xFF818650) 
+NHSTUB(GetFocusLensSubjectDistance, 0xFFAD2F88) 
+NHSTUB(TakeSemaphore, 0xFFB140E0)
+NHSTUB(kbd_pwr_off, 0xFFA30BE4)
+NHSTUB(kbd_pwr_on, 0xFFA30BA4)
+NHSTUB(SetPropertyCase, 0xFF81BB60)
+
+NHSTUB(SetZoomActuatorSpeedPercent, 0xFF9AD778) //null stub
+
+NHSTUB(GetDrive_ClusterSize, 0xFFA99780)
+NHSTUB(GetDrive_TotalClusters, 0xFFA997BC)
+NHSTUB(GetDrive_FreeClusters, 0xFFA997F8)
+NHSTUB(ExpCtrlTool_StopContiAE,  0xFF96556C) 
+NHSTUB(ExpCtrlTool_StartContiAE, 0xFF96553C) 
+NHSTUB(MakeAFScan,  0xFFAFFFDC) 
+NHSTUB(GetBatteryTemperature, 0xFFA34470)
+NHSTUB(GetCCDTemperature, 0xFFA3445C)
+NHSTUB(GetOpticalTemperature, 0xFFA34448)
+NHSTUB(PT_PlaySound, 0xFFB0B1F8)
+NHSTUB(EnterToCompensationEVF, 0xffafaa6c)
+NHSTUB(ExitFromCompensationEVF, 0xffafaaf0)
Index: /trunk/platform/ixus70_sd1000/sub/100c/boot.c
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/100c/boot.c	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/100c/boot.c	(revision 511)
@@ -0,0 +1,165 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+const long new_sa = MEMISOSTART + MEMISOSIZE;
+
+/* Ours stuff */
+extern long wrs_kernel_bss_start;
+extern long wrs_kernel_bss_end;
+extern void createHook (void *pNewTcb);
+extern void deleteHook (void *pTcb);
+
+
+void boot();
+
+/* "relocated" functions */
+void __attribute__((naked,noinline)) h_usrInit();
+void __attribute__((naked,noinline)) h_usrKernelInit();
+void __attribute__((naked,noinline)) h_usrRoot();
+
+
+
+void boot()
+{
+    long *canon_data_src = (void*)0xFFB87F30;
+    long *canon_data_dst = (void*)0x1900; 
+    long canon_data_len = 0xCA00; 
+    long *canon_bss_start = (void*)0xE300;
+    long canon_bss_len = 0xBEF70 - 0xE300;
+    long i;
+
+    asm volatile (
+	"MRC     p15, 0, R0,c1,c0\n"
+	"ORR     R0, R0, #0x1000\n"
+	"ORR     R0, R0, #4\n"
+	"ORR     R0, R0, #1\n"
+	"MCR     p15, 0, R0,c1,c0\n"
+    :::"r0");
+
+    for(i=0;i<canon_data_len/4;i++)
+	canon_data_dst[i]=canon_data_src[i];
+
+    for(i=0;i<canon_bss_len/4;i++)
+	canon_bss_start[i]=0;
+
+    asm volatile (
+	"MRC     p15, 0, R0,c1,c0\n"
+	"ORR     R0, R0, #0x1000\n"
+	"BIC     R0, R0, #4\n"
+	"ORR     R0, R0, #1\n"
+	"MCR     p15, 0, R0,c1,c0\n"
+    :::"r0");
+
+    h_usrInit();
+}
+
+
+void h_usrInit()
+{
+    asm volatile (
+	"STR     LR, [SP,#-4]!\n"
+	"BL      sub_FF811968\n"
+	"MOV     R0, #2\n"
+	"MOV     R1, R0\n"
+	"BL      sub_FF919D64\n" //unknown_libname_230
+	"BL      sub_FF90DE5C\n" //excVecInit
+	"BL      sub_FF8111C4\n"
+	"BL      sub_FF811728\n"
+	"LDR     LR, [SP],#4\n"
+	"B       h_usrKernelInit\n"
+    );
+}
+
+void  h_usrKernelInit()
+{
+    asm volatile (
+	"STMFD   SP!, {R4,LR}\n"
+	"SUB     SP, SP, #8\n"
+	"BL      sub_FF91A264\n" //classLibInit
+	"BL      sub_FF92A390\n" //taskLibInit
+	"LDR     R3, =0x59C0\n"
+	"LDR     R2, =0xBBFE0\n"
+	"LDR     R1, [R3]\n"
+	"LDR     R0, =0xBCC30\n"
+	"MOV     R3, #0x100\n"
+	"BL      sub_FF925F80\n" //qInit
+	"LDR     R3, =0x5980\n"
+	"LDR     R0, =0x5D20\n"
+	"LDR     R1, [R3]\n"
+	"BL      sub_FF925F80\n" //qInit
+	"LDR     R3, =0x5A3C\n"
+	"LDR     R0, =0xBCC04\n"
+	"LDR     R1, [R3]\n"
+	"BL      sub_FF925F80\n" //qInit
+	"BL      sub_FF92E74C\n" //workQInit
+	"BL      sub_FF8112AC\n"
+	"MOV     R4, #0\n"
+	"MOV     R3, R0\n"
+	"MOV     R12, #0x800\n"
+	"LDR     R0, =h_usrRoot\n" // R0, =sub_FF811A60 (h_usrRoot))
+	"MOV     R1, #0x4000\n"
+    );    
+//	"LDR     R2, =0xEEF70\n" // 0xBEF70 + 0x30000
+    asm volatile (
+        "LDR     R2, =new_sa\n"
+        "LDR     R2, [R2]\n"
+    );
+    asm volatile (
+	"STR     R12, [SP]\n"
+	"STR     R4, [SP,#4]\n"
+	"BL      sub_FF9275D0\n" //kernelInit
+	"ADD     SP, SP, #8\n"
+	"LDMFD   SP!, {R4,PC}\n"
+    );
+}
+
+static long drv_struct[16];
+ 
+static long dh_err()
+{
+    return -1;
+}
+
+static void drv_self_hide()
+{
+    long drvnum;
+    
+    drvnum = _iosDrvInstall(dh_err,dh_err,dh_err,dh_err,dh_err,dh_err,dh_err);
+    if (drvnum >= 0)
+	_iosDevAdd(drv_struct, "A/DISKBOOT.BIN", drvnum);
+}
+
+
+void  h_usrRoot()
+{
+    asm volatile (
+	"STMFD   SP!, {R4,R5,LR}\n"
+	"MOV     R5, R0\n"
+	"MOV     R4, R1\n"
+	"BL      sub_FF8119D0\n"
+	"MOV     R1, R4\n"
+	"MOV     R0, R5\n"
+	"BL      sub_FF91ED1C\n" //memInit
+	"MOV     R1, R4\n"
+	"MOV     R0, R5\n"
+	"BL      sub_FF91F794\n" //memPartLibInit
+//	"BL      sub_FF8117E8\n" //nullSub_1
+	"BL      sub_FF811704\n"
+	"BL      sub_FF811A0C\n"
+	"BL      sub_FF8119F0\n"
+	"BL      sub_FF811A38\n"
+	"BL      sub_FF8119C4\n"
+    );
+
+    _taskCreateHookAdd(createHook);
+    _taskDeleteHookAdd(deleteHook);
+
+    drv_self_hide();
+
+    asm volatile (
+	"LDMFD   SP!, {R4,R5,LR}\n"
+	"B       sub_FF81136C\n" //IsEmptyWriteCache_2
+    );
+}
+
Index: /trunk/platform/ixus70_sd1000/sub/100c/stubs_min.S
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/100c/stubs_min.S	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/100c/stubs_min.S	(revision 511)
@@ -0,0 +1,15 @@
+#include "stubs_asm.h"
+
+DEF(physw_status, 0x564B0) // find in "PhySw"
+DEF(physw_run, 0x87B4) // find in "PhySw"
+
+DEF(zoom_busy, 0x96804) // find in "ZoomLens"
+DEF(focus_busy, 0x95F50) // find in "FocusLens"
+DEF(playrec_mode,0xD0CC) // BL      unknown_libname_797 found in "taskcreate_SsStartupTask"
+DEF(FlashParamsTable,0xFFB3E3C8) // BL      sub_FFB3E584 found in "ParameterManager.c"
+DEF(canon_menu_active,0x3760) // found in "StartRecModeMenu"
+DEF(canon_shoot_menu_active,0x27C9) // (0x27CC - 0x4 + 0x1) found in "taskcreate_DSITask"
+DEF(recreview_hold, 0x25AC) // (0x25B0 - 0x4) found in "AR:Snd:0x%04x"
+DEF(zoom_status, 0x2680)
+DEF(movie_status, 0xBB558)
+DEF(some_flag_for_af_scan, 0xCDB4)
Index: /trunk/platform/ixus70_sd1000/sub/100c/makefile.inc
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/100c/makefile.inc	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/100c/makefile.inc	(revision 511)
@@ -0,0 +1,15 @@
+#0x314F
+PLATFORMID=12623
+
+PLATFORMOS=vxworks
+
+MEMBASEADDR=0x1900
+RESTARTSTART=0x50000
+MEMISOSTART=0xBEF70
+MEMISOSIZE=0x55000
+ROMBASEADDR=0xff810000
+
+TARGET_PRIMARY=$(topdir)platform/$(PLATFORM)/sub/$(PLATFORMSUB)/PRIMARY.BIN
+
+PLFLAGS=-DMEMBASEADDR=$(MEMBASEADDR) -DMEMISOSTART=$(MEMISOSTART) -DMEMISOSIZE=$(MEMISOSIZE)
+PLFLAGS+=-DRESTARTSTART=$(RESTARTSTART)
Index: /trunk/platform/ixus70_sd1000/sub/100c/stubs_asm.h
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/100c/stubs_asm.h	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/100c/stubs_asm.h	(revision 511)
@@ -0,0 +1,20 @@
+    .text
+
+#define DEF(n,a) \
+    .globl n; n = a
+
+#define NSTUB(name, addr)\
+    .globl _##name ;\
+    .weak _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define NHSTUB(name, addr)\
+    .globl _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define STUB(addr)\
+    .globl sub_ ## addr ;\
+    sub_ ## addr: ;\
+	ldr  pc, =0x ## addr
Index: /trunk/platform/ixus70_sd1000/sub/100c/lib.c
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/100c/lib.c	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/100c/lib.c	(revision 511)
@@ -0,0 +1,75 @@
+#include "platform.h"
+#include "keyboard.h"
+
+void *hook_raw_fptr()
+{
+    return (void*)0; //0x53B98
+}
+
+void *hook_raw_ret_addr()
+{
+    return (void*)0; //0xFF9AB668
+}
+
+char *hook_raw_image_addr()
+{
+    return (char*)0x10E706A0;
+}
+
+long hook_raw_size()
+{
+    return 0x8CAE10;
+}
+
+void *vid_get_viewport_live_fb()
+{
+//    return (void*)0;
+    void **fb=(void **)0x6F8C;
+    unsigned char buff = *((unsigned char*)0x6F9C);
+    if (buff == 0) {
+        buff = 2;
+    }
+    else {
+        buff--;
+    }
+    return fb[buff];
+}
+
+void *vid_get_bitmap_fb()
+{
+    return (void*)0x10361000;
+}
+
+void *vid_get_viewport_fb()
+{
+    return (void*)(0x1065BA50);
+}
+
+void *vid_get_viewport_fb_d()
+{
+    return (void*)(*(int*)0x94408);
+}
+
+long vid_get_bitmap_screen_width()
+{
+    return 360;
+}
+
+long vid_get_bitmap_screen_height()
+{
+    return 240;
+}
+
+long vid_get_viewport_height()
+{
+    return ((mode_get()&MODE_MASK) == MODE_PLAY)?240:230;
+}
+char *camera_jpeg_count_str()
+{
+    return (char*)0x12298;
+}
+
+long vid_get_bitmap_buffer_width() { return 360; }
+
+long vid_get_bitmap_buffer_height() { return 240; }
+
Index: /trunk/platform/ixus70_sd1000/sub/100c/movie_rec.c
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/100c/movie_rec.c	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/100c/movie_rec.c	(revision 511)
@@ -0,0 +1,358 @@
+#include "conf.h"
+
+int *video_quality = &conf.video_quality;
+int *video_mode    = &conf.video_mode;
+
+long def_table1[9]={0x2000,0x38D,0x788,0x5800,0x9C5,0x14B8,0x10000,0x1C6A,0x3C45};
+long def_table2[9]={0x1CCD,-0x2E1,-0x579,0x4F33,-0x7EB,-0xF0C,0xE666,-0x170A,-0x2BC6};
+
+long table1[9], table2[9];
+
+void change_video_tables(int a, int b){
+ int i;
+ for (i=0;i<9;i++) {table1[i]=(def_table1[i]*a)/b; table2[i]=(def_table2[i]*a)/b;}
+}
+
+long CompressionRateTable[]={0x60, 0x5D, 0x5A, 0x57, 0x54, 0x51, 0x4D, 0x48, 0x42, 0x3B, 0x32, 0x29, 0x22, 0x1D, 0x17, 0x14, 0x10, 0xE, 0xB, 9, 7, 6, 5, 4, 3, 2, 1};
+
+void __attribute__((naked,noinline)) movie_record_task(){
+ asm volatile(
+                 "STMFD   SP!, {R4,R5,LR}\n"
+                 "SUB     SP, SP, #4\n"
+                 "MOV     R5, SP\n"
+                 "MOV     R4, #0\n"
+ "loc_FFB8153C:\n"
+                 "LDR     R3, =0xBB420\n"
+                 "MOV     R2, #0\n"
+                 "LDR     R0, [R3]\n"
+                 "MOV     R1, R5\n"
+                 "BL      sub_FFB13518\n" //ReceiveMessageQueue
+                 "LDR     R3, =0xBB540\n"
+                 "LDR     R2, [R3]\n"
+                 "CMP     R2, #0\n"
+                 "BNE     loc_FFB815E8\n"
+                 "LDR     R1, [SP]\n"
+                 "LDR     R3, [R1]\n"
+                 "SUB     R3, R3, #2\n"
+                 "MOV     R0, R1\n"
+                 "CMP     R3, #9\n"
+                 "LDRLS   PC, [PC,R3,LSL#2]\n"
+                 "B       loc_FFB815EC\n"
+                 ".long loc_FFB815AC\n"
+                 ".long loc_FFB815C4\n"
+                 ".long loc_FFB815CC\n"
+                 ".long loc_FFB815D4\n"
+                 ".long loc_FFB815B4\n"
+                 ".long loc_FFB815DC\n"
+                 ".long loc_FFB815BC\n"
+                 ".long loc_FFB815EC\n"
+                 ".long loc_FFB815E4\n"
+                 ".long loc_FFB815A4\n"
+ "loc_FFB815A4:\n"
+                 "BL      sub_FFB81658\n"
+                 "B       loc_FFB815E8\n"
+ "loc_FFB815AC:\n"
+                 "BL      unlock_optical_zoom\n" 
+                 "BL      sub_FFB81860\n"
+                 "B       loc_FFB815E8\n"
+ "loc_FFB815B4:\n"
+                 "BL      sub_FFB81C40_my\n"  //--------------->
+                 "B       loc_FFB815E8\n"
+ "loc_FFB815BC:\n"
+                 "BL      sub_FFB824D0\n"
+                 "B       loc_FFB815E8\n"
+ "loc_FFB815C4:\n"
+                 "BL      sub_FFB81F84\n"
+                 "B       loc_FFB815E8\n"
+ "loc_FFB815CC:\n"
+                 "BL      sub_FFB8266C\n"
+                 "B       loc_FFB815E8\n"
+ "loc_FFB815D4:\n"
+                 "BL      sub_FFB8284C\n"
+                 "B       loc_FFB815E8\n"
+ "loc_FFB815DC:\n"
+                 "BL      sub_FFB82558\n"
+                 "B       loc_FFB815E8\n"
+ "loc_FFB815E4:\n"
+                 "BL      sub_FFB81FD4\n"
+ "loc_FFB815E8:\n"
+                 "LDR     R1, [SP]\n"
+ "loc_FFB815EC:\n"
+                 "LDR     R3, =0xBB424\n"
+                 "STR     R4, [R1]\n"
+                 "LDR     R0, [R3]\n"
+                 "MOV     R2, R4\n"
+                 "BL      sub_FFB13930\n" //PostMessageQueue
+                 "B       loc_FFB8153C\n"
+
+ );
+}
+
+void __attribute__((naked,noinline)) sub_FFB81C40_my(){
+ asm volatile(
+                 "STMFD   SP!, {R4-R11,LR}\n"
+                 "LDR     R7, =0xBB558\n"
+                 "SUB     SP, SP, #0x3C\n"
+                 "LDR     R3, [R7]\n"
+                 "MOV     R5, #0\n"
+                 "CMP     R3, #3\n"
+                 "MOV     R4, R0\n"
+                 "STR     R5, [SP,#0x34]\n"
+                 "STR     R5, [SP,#0x2C]\n"
+                 "MOV     R6, #1\n"
+                 "MOVEQ   R3, #4\n"
+                 "STREQ   R3, [R7]\n"
+                 "LDR     R3, =0xBB604\n"
+                 "MOV     LR, PC\n"
+                 "LDR     PC, [R3]\n"
+                 "LDR     R2, [R7]\n"
+                 "CMP     R2, #4\n"
+                 "BNE     loc_FFB81E9C\n"
+                 "LDR     R3, =0xBB646\n"
+                 "LDRH    R2, [R3]\n"
+                 "CMP     R2, #1\n"
+                 "BNE     loc_FFB81CD0\n"
+                 "LDR     R2, =0xBB568\n"
+                 "LDR     R1, =0xBB648\n"
+                 "LDR     R0, [R2]\n"
+                 "LDRH    R3, [R1]\n"
+                 "MUL     R12, R3, R0\n"
+                 "LDR     R2, =0x10624DD3\n"
+                 "UMULL   R3, R1, R2, R12\n"
+                 "LDR     R3, =0xBB584\n"
+                 "MOV     R1, R1,LSR#6\n"
+                 "LDR     R0, [R3]\n"
+                 "BL      sub_FF914660\n" //__umodsi3
+                 "CMP     R0, #0\n"
+                 "MOVNE   R6, #0\n"
+                 "MOVEQ   R6, #1\n"
+ "loc_FFB81CD0:\n"
+                 "CMP     R6, #1\n"
+                 "BNE     loc_FFB81CF0\n"
+                 "ADD     R0, SP,#0x38\n"
+                 "ADD     R1, SP,#0x34\n"
+                 "ADD     R2, SP,#0x30\n"
+                 "ADD     R3, SP,#0x2C\n"
+                 "BL      sub_FFB83408\n"
+                 "MOV     R5, R0\n"
+ "loc_FFB81CF0:\n"
+                 "CMP     R5, #0\n"
+                 "BNE     loc_FFB81D20\n"
+                 "LDR     R3, =0xBB548\n"
+                 "LDR     R2, [R3]\n"
+                 "CMP     R2, #1\n"
+                 "BNE     loc_FFB81D34\n"
+                 "LDR     R2, =0xBB584\n"
+                 "LDR     R1, =0xBB55C\n"
+                 "LDR     R0, [R2]\n"
+                 "LDR     R3, [R1]\n"
+                 "CMP     R0, R3\n"
+                 "BCC     loc_FFB81D34\n"
+ "loc_FFB81D20:\n"
+                 "MOV     R0, R5\n"
+                 "BL      sub_FFB81EFC\n"
+                 "BL      sub_FFB82490\n"
+                 "MOV     R3, #5\n"
+                 "B       loc_FFB81E98\n"
+ "loc_FFB81D34:\n"
+                 "LDR     R9, [SP,#0x34]\n"
+                 "CMP     R9, #0\n"
+                 "BEQ     loc_FFB81E1C\n"
+                 "LDR     R7, =0xBB5A0\n"
+                 "LDR     R12, =0xBB58C\n"
+                 "LDMIB   R4, {R0-R2}\n"
+                 "LDR     R10, [R4,#0x18]\n"
+                 "LDR     R6, [R7]\n"
+                 "LDR     R7, [R4,#0x14]\n"
+                 "LDR     R4, =0xBB54C\n"
+                 "LDR     R8, [R12]\n"
+                 "ADD     R5, SP, #0x2C\n"
+                 "LDMIA   R5, {R5,LR}\n"
+                 "MOV     R11, #1\n"
+                 "LDR     R3, [SP,#0x38]\n"
+                 "ADD     R12, SP, #0x28\n"
+                 "STR     R11, [R4]\n"
+                 "ADD     R4, SP, #0x24\n"
+                 "STMEA   SP, {R9,LR}\n"
+                 "STR     R5, [SP,#0x8]\n"
+                 "STR     R12, [SP,#0xC]\n"
+                 "STR     R8, [SP,#0x10]\n"
+                 "STR     R6, [SP,#0x14]\n"
+                 "STR     R7, [SP,#0x18]\n"
+                 "STR     R10, [SP,#0x1C]\n"
+                 "STR     R4, [SP,#0x20]\n"
+                 "BL      sub_FFB864B4\n"
+                 "LDR     R3, =0xBB418\n"
+                 "MOV     R1, #0x3E8\n"
+                 "LDR     R0, [R3]\n"
+                 "BL      sub_FFB140E0\n"
+                 "CMP     R0, #9\n"
+                 "BNE     loc_FFB81DC8\n"
+                 "BL      sub_FFB83C98\n"
+                 "LDR     R3, =0xBB558\n"
+                 "LDR     R0, =0xFFB81C28\n" //aJpegtimeout_5
+                 "B       loc_FFB81DE0\n"
+ "loc_FFB81DC8:\n"
+                 "LDR     R4, [SP,#0x24]\n"
+                 "CMP     R4, #0\n"
+                 "BEQ     loc_FFB81DEC\n"
+                 "BL      sub_FFB83C98\n"
+                 "LDR     R3, =0xBB558\n"
+                 "LDR     R0, =0xFFB81C34\n" //aJpegicerror_5
+ "loc_FFB81DE0:\n"
+                 "STR     R11, [R3]\n"
+                 "BL      sub_FFB36E94\n"
+                 "B       loc_FFB81E9C\n"
+ "loc_FFB81DEC:\n"
+                 "BL      sub_FFB86630\n"
+                 "LDR     R0, [SP,#0x38]\n"
+                 "LDR     R1, [SP,#0x28]\n"
+                 "BL      sub_FFB838F0\n"
+                 "LDR     R12, =0xBB580\n"
+                 "LDR     R3, [R12]\n"
+                 "ADD     R3, R3, #1\n"
+                 "LDR     R0, [SP,#0x28]\n"
+                 "LDR     R1, =0xBB5A0\n"
+                 "MOV     R2, R4\n"
+                 "STR     R3, [R12]\n"
+                 "BL      sub_FFAF2B50_my\n"   //----------------->
+ "loc_FFB81E1C:\n"
+                 "LDR     R4, =0xBB584\n"
+                 "LDR     R2, =0xBB5AC\n"
+                 "LDR     R3, [R4]\n"
+                 "LDR     R1, [R2]\n"
+                 "LDR     R12, =0xBB5A8\n"
+                 "ADD     R3, R3, #1\n"
+                 "MUL     R0, R1, R3\n"
+                 "LDR     R1, [R12]\n"
+                 "STR     R3, [R4]\n"
+                 "BL      sub_FF9145C8\n" //__udivsi3
+                 "LDR     R6, =0xBB5A4\n"
+                 "MOV     R4, R0\n"
+                 "BL      sub_FFB83CD4\n"
+                 "LDR     R3, [R6]\n"
+                 "CMP     R3, R4\n"
+                 "BNE     loc_FFB81E70\n"
+                 "LDR     R5, =0xBB550\n"
+                 "LDR     R3, [R5]\n"
+                 "CMP     R3, #1\n"
+                 "BNE     loc_FFB81E90\n"
+                 "B       loc_FFB81E74\n"
+ "loc_FFB81E70:\n"
+                 "LDR     R5, =0xBB550\n"
+ "loc_FFB81E74:\n"
+                 "LDR     R2, =0xBB5E8\n"
+                 "MOV     R0, R4\n"
+                 "MOV     LR, PC\n"
+                 "LDR     PC, [R2]\n"
+                 "MOV     R3, #0\n"
+                 "STR     R3, [R5]\n"
+                 "STR     R4, [R6]\n"
+ "loc_FFB81E90:\n"
+                 "LDR     R7, =0xBB54C\n"
+                 "MOV     R3, #0\n"
+ "loc_FFB81E98:\n"
+                 "STR     R3, [R7]\n"
+ "loc_FFB81E9C:\n"
+                 "ADD     SP, SP, #0x3C\n"
+                 "LDMFD   SP!, {R4-R11,PC}\n"
+ );
+}
+
+void __attribute__((naked,noinline)) sub_FFAF2B50_my(){
+ asm volatile(
+                 "STMFD   SP!, {R4-R8,LR}\n"
+                 "LDR     R12, =0x96ED4\n"
+                 "LDR     R4, [R12]\n"
+                 "LDR     R3, =0x96EDC\n"
+                 "CMP     R4, #0\n"
+                 "MOV     R8, R1\n"
+                 "MOV     R7, R0\n"
+                 "LDR     R1, [R3]\n"
+                 "BEQ     loc_FFAF2B88\n"
+                 "LDR     R2, =0x96EE0\n"
+                 "LDR     R3, [R2]\n"
+                 "CMP     R3, #1\n"
+                 "BNE     loc_FFAF2B9C\n"
+                 "B       loc_FFAF2B8C\n"
+ "loc_FFAF2B88:\n"
+                 "LDR     R2, =0x96EE0\n"
+ "loc_FFAF2B8C:\n"
+                 "MOV     R3, #0\n"
+                 "STR     R3, [R2]\n"
+                 "STR     R7, [R12]\n"
+                 "B       loc_FFAF2C54\n"
+ "loc_FFAF2B9C:\n"
+                 "LDR     R2, =0x96ED8\n"
+                 "LDR     R3, [R2]\n"
+                 "LDR     R6, =table1\n"          // + 0xFFAF2A54
+                 "ADD     R3, R3, R3,LSL#1\n"
+                 "MOV     LR, R3,LSL#2\n"
+                 "LDR     R2, [R6,LR]\n"
+                 "LDR     R5, =table2\n"          // + 0xFFAF2A78
+                 "RSB     R12, R2, R4\n"
+                 "LDR     R3, [R5,LR]\n"
+                 "CMP     R12, #0\n"
+                 "RSB     R0, R3, R4\n"
+                 "BLE     loc_FFAF2C00\n"
+                 "ADD     R3, R6, #4\n"
+                 "LDR     R2, [R3,LR]\n"
+                 "CMP     R2, R12\n"
+                 "ADDGE   R1, R1, #1\n"
+                 "BGE     loc_FFAF2BF4\n"
+                 "ADD     R3, R6, #8\n"
+                 "LDR     R2, [R3,LR]\n"
+                 "CMP     R2, R12\n"
+                 "ADDGE   R1, R1, #2\n"
+                 "ADDLT   R1, R1, #3\n"
+ "loc_FFAF2BF4:\n"
+         //      "CMP     R1, #0x16\n"     // -
+         //      "MOVGE   R1, #0x16\n"     // -
+                 "CMP     R1, #0x1A\n"     // + 
+                 "MOVGE   R1, #0x1A\n"     // + 
+
+                 "B       loc_FFAF2C38\n"
+ "loc_FFAF2C00:\n"
+                 "CMP     R0, #0\n"
+                 "BGE     loc_FFAF2C38\n"
+                 "ADD     R3, R5, #4\n"
+                 "LDR     R2, [R3,LR]\n"
+                 "CMP     R2, R0\n"
+                 "SUBLE   R1, R1, #1\n"
+                 "BLE     loc_FFAF2C30\n"
+                 "ADD     R3, R5, #8\n"
+                 "LDR     R2, [R3,LR]\n"
+                 "CMP     R2, R0\n"
+                 "SUBLE   R1, R1, #2\n"
+                 "SUBGT   R1, R1, #3\n"
+ "loc_FFAF2C30:\n"
+                 "CMP     R1, #0\n"
+                 "MOVLT   R1, #0\n"
+ "loc_FFAF2C38:\n"
+                 "LDR     R0, =0x96EDC\n"
+                 "LDR     R3, [R0]\n"
+                 "CMP     R1, R3\n"
+                 "LDRNE   R2, =0x96EE0\n"
+                 "MOVNE   R3, #1\n"
+                 "STRNE   R1, [R0]\n"
+                 "STRNE   R3, [R2]\n"
+ "loc_FFAF2C54:\n"
+                 "LDR     R3, =0x96EDC\n"
+                 "LDR     R2, =CompressionRateTable\n"
+                 "LDR     R1, [R3]\n"
+                 "LDR     R0, =0x96ED4\n"
+                 "LDR     R3, [R2,R1,LSL#2]\n"
+
+                 "LDR     R1, =video_mode\n"      // +
+                 "LDR     R1, [R1]\n"             // +
+                 "LDR     R1, [R1]\n"             // +
+                 "CMP     R1, #1\n"               // +
+                 "LDREQ   R1, =video_quality\n"   // +     
+                 "LDREQ   R1, [R1]\n"             // +     
+                 "LDREQ   R3, [R1]\n"             // +     
+       
+                 "STR     R7, [R0]\n"
+                 "STR     R3, [R8]\n"
+                 "LDMFD   SP!, {R4-R8,PC}\n"
+ );
+}
Index: /trunk/platform/ixus70_sd1000/sub/100c/stubs_auto.S
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/100c/stubs_auto.S	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/100c/stubs_auto.S	(revision 511)
@@ -0,0 +1,93 @@
+/* THIS FILE IS GENERATED */
+/* DO NOT EDIT THIS FILE! */
+
+#include "stubs_asm.h"
+
+STUB(FF8111C4)
+STUB(FF8112AC)
+STUB(FF81136C)
+STUB(FF811704)
+STUB(FF811728)
+STUB(FF8117E8)
+STUB(FF811968)
+STUB(FF8119C4)
+STUB(FF8119D0)
+STUB(FF8119F0)
+STUB(FF811A0C)
+STUB(FF811A38)
+STUB(FF81BC98)
+STUB(FF81BE94)
+STUB(FF8261B8)
+STUB(FF90DE5C)
+STUB(FF9145C8)
+STUB(FF914660)
+STUB(FF919D64)
+STUB(FF91A264)
+STUB(FF91ED1C)
+STUB(FF91F794)
+STUB(FF925F80)
+STUB(FF9275D0)
+STUB(FF92A390)
+STUB(FF92E74C)
+STUB(FFA3957C)
+STUB(FFAF2B50)
+STUB(FFAFCE14)
+STUB(FFAFD38C)
+STUB(FFAFE9E4)
+STUB(FFAFEB08)
+STUB(FFAFEBE4)
+STUB(FFAFECC0)
+STUB(FFAFED9C)
+STUB(FFAFF304)
+STUB(FFAFF6BC)
+STUB(FFAFF6CC)
+STUB(FFAFF6DC)
+STUB(FFAFF704)
+STUB(FFAFF81C)
+STUB(FFAFF88C)
+STUB(FFAFF924)
+STUB(FFAFFA78)
+STUB(FFB008C0)
+STUB(FFB00FF4)
+STUB(FFB011C8)
+STUB(FFB0125C)
+STUB(FFB01358)
+STUB(FFB01498)
+STUB(FFB014F4)
+STUB(FFB015C4)
+STUB(FFB01798)
+STUB(FFB01834)
+STUB(FFB018F4)
+STUB(FFB01BC4)
+STUB(FFB01CA4)
+STUB(FFB01DBC)
+STUB(FFB01E20)
+STUB(FFB02138)
+STUB(FFB02698)
+STUB(FFB0282C)
+STUB(FFB09134)
+STUB(FFB12E00)
+STUB(FFB12F9C)
+STUB(FFB13518)
+STUB(FFB13930)
+STUB(FFB140E0)
+STUB(FFB14ADC)
+STUB(FFB20628)
+STUB(FFB36E94)
+STUB(FFB81658)
+STUB(FFB81860)
+STUB(FFB81C40)
+STUB(FFB81EFC)
+STUB(FFB81F84)
+STUB(FFB81FD4)
+STUB(FFB82490)
+STUB(FFB824D0)
+STUB(FFB82558)
+STUB(FFB8266C)
+STUB(FFB8284C)
+STUB(FFB83408)
+STUB(FFB838F0)
+STUB(FFB83C98)
+STUB(FFB83CD4)
+STUB(FFB864B4)
+STUB(FFB86630)
Index: /trunk/platform/ixus70_sd1000/sub/100c/Makefile
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/100c/Makefile	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/100c/Makefile	(revision 511)
@@ -0,0 +1,6 @@
+topdir=../../../../
+
+OBJS=boot.o stubs_min.o stubs_auto.o stubs_entry.o lib.o stubs_entry_2.o capt_seq.o movie_rec.o
+STUBS_AUTO_DEPS=boot.c capt_seq.c movie_rec.c
+
+include $(topdir)/platform/makefile_sub.inc
Index: /trunk/platform/ixus70_sd1000/sub/101b/capt_seq.c
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/101b/capt_seq.c	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/101b/capt_seq.c	(revision 511)
@@ -0,0 +1,292 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+#define RAWDATA_AVAILABLE (1)
+#define RAWDATA_SAVED (2)
+
+#define NR_ON (2)
+#define NR_OFF (1)
+
+static long raw_save_stage;
+
+void capt_seq_hook_raw_here()
+{
+    raw_save_stage = RAWDATA_AVAILABLE;
+    core_rawdata_available();
+    while (raw_save_stage != RAWDATA_SAVED){
+	_SleepTask(10);
+    }
+}
+
+void hook_raw_save_complete()
+{
+    raw_save_stage = RAWDATA_SAVED;
+}
+
+
+void capt_seq_hook_set_nr()
+{
+    long *nrflag = (long*)0xCDA0;
+
+    switch (core_get_noise_reduction_value()){
+    case NOISE_REDUCTION_AUTO_CANON:
+	// leave it alone
+	break;
+    case NOISE_REDUCTION_OFF:
+	*nrflag = 1;
+	break;
+    case NOISE_REDUCTION_ON:
+	*nrflag = 2;
+	break;
+    };
+}
+
+
+void __attribute__((naked,noinline)) sub_FFB01E30_my(long p)
+{
+    asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                "MOV     R4, R0\n"
+                "SUB     SP, SP, #0xC\n"
+                "BL      sub_FFB028A0\n"
+                "MVN     R1, #0\n"
+                "BL      sub_FFB13010\n"
+                "MOV     R0, #0x8A\n"
+                "ADD     R1, SP, #4\n"
+                "MOV     R2, #4\n"
+                "BL      sub_FF81BC98\n"
+                "TST     R0, #1\n"
+                "BEQ     loc_FFB01E70\n"
+                "MOV     R1, #0x1D0\n"
+                "LDR     R0, =0xFFB01CB4\n"
+                "ADD     R1, R1, #2\n"
+                "BL      sub_FFB2069C\n"
+"loc_FFB01E70:\n"
+                "LDR     R3, =0xBDA80\n"
+                "LDR     R2, =0xBDB40\n"
+                "LDR     R0, [R3,#0x7C]\n"
+                "LDRSH   R1, [R2,#0xE]\n"
+                "BL      sub_FFA395F0\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FFB01C38\n"
+                "BL      wait_until_remote_button_is_released\n"
+                "BL      capt_seq_hook_set_nr\n"  // +
+                "LDR     R3, =0xCDA4\n"
+                "LDR     R0, [R3]\n"
+                "B       sub_FFB01E94\n"
+    );
+}
+
+void __attribute__((naked,noinline)) sub_FFAFEC58_my(long p)
+{
+    asm volatile (
+                "STMFD   SP!, {R4,R5,LR}\n"
+                "LDR     R3, =0xBDA80\n"
+                "LDR     R5, [R0,#0xC]\n"
+                "LDR     R1, [R3,#0x24]\n"
+                "LDR     R2, [R5,#8]\n"
+                "CMP     R1, #0\n"
+                "ORR     R2, R2, #1\n"
+                "STR     R2, [R5,#8]\n"
+                "BNE     loc_FFAFECAC\n"
+                "MOV     R0, #0xC\n"
+                "BL      sub_FFB091A8\n"
+                "TST     R0, #1\n"
+                "BEQ     loc_FFAFECAC\n"
+                "LDR     R3, [R5,#8]\n"
+                "MOV     R0, #1\n"
+                "ORR     R3, R3, #0x40000000\n"
+                "STR     R3, [R5,#8]\n"
+"loc_FFAFEC9C:\n"
+                "MOV     R2, R5\n"
+                "MOV     R1, #1\n"
+                "LDMFD   SP!, {R4,R5,LR}\n"
+                "B       sub_FFAFD400\n"
+"loc_FFAFECAC:\n"
+                "LDR     R4, =0xBDA80\n"
+                "BL      sub_FFAFF750\n"
+                "LDR     R3, [R4,#0x24]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FFAFECF4\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FFB00934\n"
+                "TST     R0, #1\n"
+                "BNE     loc_FFAFEC9C\n"
+                "BL      sub_FF8261B8\n"
+                "BL      sub_FF81BE94\n"
+                "STR     R0, [R5,#0x14]\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FFB01D18\n"
+                "BL      sub_FFB0270C\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FFB01E30_my\n"         //------------->
+                "BL      capt_seq_hook_raw_here\n"  // +
+                "B       loc_FFAFED08\n"
+"loc_FFAFECF4:\n"
+                "LDR     R3, =0xCD8C\n"
+                "LDR     R2, [R3]\n"
+                "CMP     R2, #0\n"
+                "MOVNE   R0, #0x1D\n"
+                "MOVEQ   R0, #0\n"
+"loc_FFAFED08:\n"
+                "MOV     R1, #1\n"
+                "MOV     R2, R5\n"
+                "BL      sub_FFAFD400\n"
+                "BL      sub_FFB021AC\n"
+                "CMP     R0, #0\n"
+                "LDRNE   R3, [R5,#8]\n"
+                "ORRNE   R3, R3, #0x2000\n"
+                "STRNE   R3, [R5,#8]\n"
+                "LDMFD   SP!, {R4,R5,PC}\n"
+    );
+}
+
+void __attribute__((naked,noinline)) capt_seq_task()
+{
+	asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                "SUB     SP, SP, #4\n"
+                "MOV     R4, SP\n"
+                "B       loc_FFAFF290\n"
+"loc_FFAFF114:\n"
+                "LDR     R2, [SP]\n"
+                "LDR     R3, [R2]\n"
+                "MOV     R0, R2\n"
+                "CMP     R3, #0x15\n"
+                "LDRLS   PC, [PC,R3,LSL#2]\n"
+                "B       loc_FFAFF264\n"
+                ".long loc_FFAFF184\n"
+                ".long loc_FFAFF1A4\n"
+                ".long loc_FFAFF1B8\n"
+                ".long loc_FFAFF1CC\n"
+                ".long loc_FFAFF1C4\n"
+                ".long loc_FFAFF1D4\n"
+                ".long loc_FFAFF1DC\n"
+                ".long loc_FFAFF1E8\n"
+                ".long loc_FFAFF1F0\n"
+                ".long loc_FFAFF1FC\n"
+                ".long loc_FFAFF204\n"
+                ".long loc_FFAFF20C\n"
+                ".long loc_FFAFF214\n"
+                ".long loc_FFAFF21C\n"
+                ".long loc_FFAFF224\n"
+                ".long loc_FFAFF230\n"
+                ".long loc_FFAFF238\n"
+                ".long loc_FFAFF240\n"
+                ".long loc_FFAFF248\n"
+                ".long loc_FFAFF254\n"
+                ".long loc_FFAFF25C\n"
+                ".long loc_FFAFF278\n"
+"loc_FFAFF184:\n"
+                "BL      sub_FFAFF778\n"
+
+                "BL      shooting_expo_param_override\n" // +
+
+                "BL      sub_FFAFCE88\n"
+                "LDR     R3, =0xBDA80\n"
+                "LDR     R2, [R3,#0x24]\n"
+                "CMP     R2, #0\n"
+                "BEQ     loc_FFAFF274\n"
+                "BL      sub_FFAFED34\n"
+                "B       loc_FFAFF274\n"
+"loc_FFAFF1A4:\n"
+                "BL      sub_FFAFEC58_my\n"  //------------>
+"loc_FFAFF1A8:\n"
+                "LDR     R2, =0xBDA80\n"
+                "MOV     R3, #0\n"
+                "STR     R3, [R2,#0x24]\n"
+                "B       loc_FFAFF274\n"
+"loc_FFAFF1B8:\n"
+                "MOV     R0, #1\n"
+                "BL      sub_FFAFF998\n"
+                "B       loc_FFAFF274\n"
+"loc_FFAFF1C4:\n"
+                "BL      sub_FFAFF378\n"
+                "B       loc_FFAFF1A8\n"
+"loc_FFAFF1CC:\n"
+                "BL      sub_FFAFF730\n"
+                "B       loc_FFAFF1A8\n"
+"loc_FFAFF1D4:\n"
+                "BL      sub_FFAFF740\n"
+                "B       loc_FFAFF274\n"
+"loc_FFAFF1DC:\n"
+                "BL      sub_FFAFF890\n"
+                "BL      sub_FFAFCE88\n"
+                "B       loc_FFAFF274\n"
+"loc_FFAFF1E8:\n"
+                "BL      sub_FFAFEE10\n"
+                "B       loc_FFAFF274\n"
+"loc_FFAFF1F0:\n"
+                "BL      sub_FFAFF900\n"
+                "BL      sub_FFAFCE88\n"
+                "B       loc_FFAFF274\n"
+"loc_FFAFF1FC:\n"
+                "BL      sub_FFAFF730\n"
+                "B       loc_FFAFF274\n"
+"loc_FFAFF204:\n"
+                "BL      sub_FFB01068\n"
+                "B       loc_FFAFF274\n"
+"loc_FFAFF20C:\n"
+                "BL      sub_FFB0123C\n"
+                "B       loc_FFAFF274\n"
+"loc_FFAFF214:\n"
+                "BL      sub_FFB012D0\n"
+                "B       loc_FFAFF274\n"
+"loc_FFAFF21C:\n"
+                "BL      sub_FFB013CC\n"
+                "B       loc_FFAFF274\n"
+"loc_FFAFF224:\n"
+                "MOV     R0, #0\n"
+                "BL      sub_FFB01638\n"
+                "B       loc_FFAFF274\n"
+"loc_FFAFF230:\n"
+                "BL      sub_FFB0180C\n"
+                "B       loc_FFAFF274\n"
+"loc_FFAFF238:\n"
+                "BL      sub_FFB018A8\n"
+                "B       loc_FFAFF274\n"
+"loc_FFAFF240:\n"
+                "BL      sub_FFB01968\n"
+                "B       loc_FFAFF274\n"
+"loc_FFAFF248:\n"
+                "BL      sub_FFAFFAEC\n"
+                "BL      sub_FFAFEB7C\n"
+                "B       loc_FFAFF274\n"
+"loc_FFAFF254:\n"
+                "BL      sub_FFB0150C\n"
+                "B       loc_FFAFF274\n"
+"loc_FFAFF25C:\n"
+                "BL      sub_FFB01568\n"
+                "B       loc_FFAFF274\n"
+"loc_FFAFF264:\n"
+                "MOV     R1, #0x4C0\n"
+                "LDR     R0, =0xFFAFE9D8\n"
+                "ADD     R1, R1, #0xE\n"
+                "BL      sub_FFB2069C\n"
+"loc_FFAFF274:\n"
+                "LDR     R2, [SP]\n"
+"loc_FFAFF278:\n"
+                "LDR     R3, =0x97348\n"
+                "LDR     R1, [R2,#4]\n"
+                "LDR     R0, [R3]\n"
+                "BL      sub_FFB12E74\n"
+                "LDR     R0, [SP]\n"
+                "BL      sub_FFAFEA58\n"
+"loc_FFAFF290:\n"
+                "LDR     R3, =0x9734C\n"
+                "MOV     R1, R4\n"
+                "LDR     R0, [R3]\n"
+                "MOV     R2, #0\n"
+                "BL      sub_FFB1358C\n"
+                "TST     R0, #1\n"
+                "BEQ     loc_FFAFF114\n"
+                "LDR     R0, =0xFFAFE9D8\n"
+                "MOV     R1, #0x400\n"
+                "BL      sub_FFB2069C\n"
+                "BL      sub_FFB14B50\n"
+                "ADD     SP, SP, #4\n"
+                "LDMFD   SP!, {R4,PC}\n"
+	);
+}
+
Index: /trunk/platform/ixus70_sd1000/sub/101b/stubs_entry.S
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/101b/stubs_entry.S	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/101b/stubs_entry.S	(revision 511)
@@ -0,0 +1,183 @@
+// !!! THIS FILE IS GENERATED. DO NOT EDIT. !!!
+#include "stubs_asm.h"
+
+// Best match: 95%
+NSTUB(AllocateMemory, 0xff811e34)
+// ALT: NSTUB(AllocateMemory, 0xff811e34) // 23/1
+NSTUB(AllocateUncacheableMemory, 0xff81e5a4)
+// ERROR: Close is not found!
+// Best match: 93%
+NSTUB(CreatePhysicalVram, 0xffa25e0c)
+NSTUB(CreateTask, 0xffb14790)
+NSTUB(CreateTaskStrict, 0xffb15830)
+NSTUB(DisableDispatch, 0xffb145b4)
+// ERROR: DisplayImagePhysicalScreen is not found!
+NSTUB(EnableDispatch, 0xffb14640)
+NSTUB(ExecuteEventProcedure, 0xff814a58)
+NSTUB(ExitTask, 0xffb14b50)
+NSTUB(Fclose_Fut, 0xffa95750)
+NSTUB(Fopen_Fut, 0xffa95710)
+NSTUB(Fread_Fut, 0xffa9580c)
+// Best match: 95%
+NSTUB(FreeMemory, 0xff811e40)
+// ALT: NSTUB(FreeMemory, 0xff811e40) // 23/1
+// Best match: 90%
+NSTUB(FreeUncacheableMemory, 0xff81e5d8)
+NSTUB(Fseek_Fut, 0xffa95900)
+NSTUB(Fwrite_Fut, 0xffa95860)
+NSTUB(GetCurrentAvValue, 0xffa50268)
+// ALT: NSTUB(GetCurrentAvValue, 0xffa52838) // 13/0
+NSTUB(GetCurrentTargetDistance, 0xffa527e0)
+// Best match: 90%
+NSTUB(GetFocusLensSubjectDistance, 0xffad2fb4)
+// ALT: NSTUB(GetFocusLensSubjectDistance, 0xffad2fb4) // 28/3
+NSTUB(GetFocusLensSubjectDistanceFromLens, 0xffad34a8)
+// Best match: 86%
+NSTUB(GetParameterData, 0xffb39c60)
+// Best match: 89%
+NSTUB(GetPropertyCase, 0xff81bc98)
+// Best match: 96%
+NSTUB(GetSystemTime, 0xff8136ec)
+// ALT: NSTUB(GetSystemTime, 0xff8136ec) // 26/1
+// Best match: 68%
+NSTUB(GetZoomLensCurrentPoint, 0xffae5ee4)
+// ALT: NSTUB(GetZoomLensCurrentPoint, 0xffae5ee4) // 20/9
+// Best match: 51%
+NSTUB(GetZoomLensCurrentPosition, 0xffae5ef8)
+// ALT: NSTUB(GetZoomLensCurrentPosition, 0xffae5ef8) // 15/14
+NSTUB(IsStrobeChargeCompleted, 0xff9a43a8)
+NSTUB(LockMainPower, 0xffb36b74)
+// Best match: 61%
+NSTUB(MakeDirectory, 0xffa9a338)
+// ERROR: Mount_FileSystem is not found!
+// Best match: 73%
+NSTUB(MoveFocusLensToDistance, 0xffa52a78)
+NSTUB(MoveZoomLensWithPoint, 0xffae5dbc)
+// ALT: NSTUB(MoveZoomLensWithPoint, 0xffae5dbc) // 25/0
+// Best match: 66%
+NSTUB(Open, 0xffa99fe0)
+// Best match: 93%
+NSTUB(PhySw_testgpio, 0xffa30ce4)
+NSTUB(ProtectFile, 0xffa94c34)
+// Best match: 92%
+NSTUB(PutInNdFilter, 0xffa5044c)
+// ALT: NSTUB(PutInNdFilter, 0xffa5044c) // 25/2
+// Best match: 94%
+NSTUB(PutOutNdFilter, 0xffa50494)
+// ALT: NSTUB(PutOutNdFilter, 0xffa50494) // 16/1
+// ERROR: Read is not found!
+// Best match: 58%
+NSTUB(RefreshPhysicalScreen, 0xff90bc18)
+// ERROR: Remove is not found!
+NSTUB(SetAutoShutdownTime, 0xffb36a78)
+// Best match: 86%
+NSTUB(SetParameterData, 0xffb39b80)
+// Best match: 73%
+NSTUB(SetPropertyCase, 0xff81bb5c)
+NSTUB(SleepTask, 0xffb146a4)
+// Best match: 61%
+NSTUB(TakeSemaphore, 0xffb1415c)
+NSTUB(UnlockMainPower, 0xffb36c0c)
+NSTUB(Unmount_FileSystem, 0xffa993d4)
+// Best match: 89%
+NSTUB(UnsetZoomForMovie, 0xff834a74)
+NSTUB(UpdateMBROnFlash, 0xffa99528)
+// Best match: 96%
+NSTUB(VbattGet, 0xffa2ccd8)
+// ERROR: Write is not found!
+NSTUB(_log, 0xff912db4)
+// ALT: NSTUB(_log, 0xff912db4) // 27/0
+NSTUB(_log10, 0xff90fb5c)
+// ALT: NSTUB(_log10, 0xff90fb5c) // 27/0
+NSTUB(_pow, 0xff90fcdc)
+// ALT: NSTUB(_pow, 0xff90fcdc) // 25/0
+NSTUB(_sqrt, 0xff911b9c)
+// ALT: NSTUB(_sqrt, 0xff911b9c) // 24/0
+NSTUB(chdir, 0xff91d840)
+// ALT: NSTUB(chdir, 0xff91d840) // 27/0
+NSTUB(close, 0xff91d180)
+NSTUB(closedir, 0xffb52640)
+// ERROR: free is not found!
+NSTUB(ints_disable, 0xffb12840)
+NSTUB(ints_enable, 0xffb1284c)
+NSTUB(ioctl, 0xff91d2c0)
+NSTUB(iosDevAdd, 0xff91e3a0)
+NSTUB(iosDrvInstall, 0xff91e664)
+NSTUB(isalpha, 0xff914758)
+// ALT: NSTUB(isalpha, 0xff914758) // 4/0
+NSTUB(isdigit, 0xff914788)
+// ALT: NSTUB(isdigit, 0xff914788) // 4/0
+NSTUB(islower, 0xff9147b8)
+// ALT: NSTUB(islower, 0xff9147b8) // 4/0
+NSTUB(isspace, 0xff914800)
+// ALT: NSTUB(isspace, 0xff914800) // 4/0
+NSTUB(isupper, 0xff914818)
+// ALT: NSTUB(isupper, 0xff914818) // 4/0
+NSTUB(kbd_p1_f, 0xffa2f1ec)
+NSTUB(kbd_p1_f_cont, 0xffa2f1f8)
+// Best match: 56%
+NSTUB(kbd_p2_f, 0xffa2f61c)
+// Best match: 83%
+NSTUB(kbd_pwr_off, 0xffa2e504)
+// ALT: NSTUB(kbd_pwr_off, 0xffa2e520) // 5/1
+// ALT: NSTUB(kbd_pwr_off, 0xffa30ca0) // 5/1
+// ALT: NSTUB(kbd_pwr_off, 0xffa30cbc) // 5/1
+// Best match: 55%
+NSTUB(kbd_pwr_on, 0xffa27648)
+// ALT: NSTUB(kbd_pwr_on, 0xffa27674) // 5/4
+// ALT: NSTUB(kbd_pwr_on, 0xffa27b74) // 5/4
+// ERROR: kbd_read_keys_r2 is not found!
+// Best match: 93%
+NSTUB(localtime, 0xff918fd8)
+NSTUB(lseek, 0xff91d2c4)
+// Best match: 53%
+NSTUB(malloc, 0xff9201c0)
+// ALT: NSTUB(malloc, 0xff9201c0) // 15/13
+NSTUB(memcmp, 0xff9183b8)
+// ALT: NSTUB(memcmp, 0xff924380) // 9/0
+NSTUB(memcpy, 0xff9183f4)
+NSTUB(memset, 0xff91846c)
+// Best match: 51%
+NSTUB(mkdir, 0xffa9a270)
+// ALT: NSTUB(mkdir, 0xffa9a344) // 16/15
+NSTUB(open, 0xff91d7c4)
+NSTUB(opendir, 0xffb52674)
+NSTUB(qsort, 0xff917c18)
+NSTUB(rand, 0xff917c3c)
+// ALT: NSTUB(rand, 0xff917c3c) // 8/0
+NSTUB(read, 0xff91d1e0)
+NSTUB(readdir, 0xffb5260c)
+NSTUB(rename, 0xff91d7cc)
+// ALT: NSTUB(rename, 0xff91d7cc) // 26/0
+NSTUB(rewinddir, 0xffb52634)
+NSTUB(srand, 0xff917c60)
+// ALT: NSTUB(srand, 0xff917c60) // 4/0
+NSTUB(stat, 0xffb52708)
+NSTUB(strcat, 0xff91848c)
+NSTUB(strchr, 0xff9184b8)
+NSTUB(strcmp, 0xff9184dc)
+NSTUB(strcpy, 0xff918670)
+NSTUB(strlen, 0xff9187d4)
+NSTUB(strncmp, 0xff918838)
+NSTUB(strncpy, 0xff91887c)
+// ALT: NSTUB(strncpy, 0xff91887c) // 24/0
+NSTUB(strpbrk, 0xff9188c4)
+NSTUB(strrchr, 0xff918900)
+// ALT: NSTUB(strrchr, 0xff918900) // 8/0
+NSTUB(strtol, 0xff918054)
+NSTUB(taskCreateHookAdd, 0xff922e20)
+NSTUB(taskDeleteHookAdd, 0xff922d5c)
+// Best match: 82%
+NSTUB(taskIdListGet, 0xff92a308)
+NSTUB(taskLock, 0xff92a9c4)
+NSTUB(taskName, 0xff92a200)
+NSTUB(taskResume, 0xff92a5e4)
+NSTUB(taskSuspend, 0xff92a410)
+NSTUB(taskUnlock, 0xff92aa6c)
+NSTUB(time, 0xff919d24)
+// ALT: NSTUB(time, 0xff919d24) // 25/0
+// Best match: 57%
+NSTUB(utime, 0xffb5279c)
+// ALT: NSTUB(utime, 0xffb5279c) // 15/11
+NSTUB(vsprintf, 0xff91bf28)
+NSTUB(write, 0xff91d250)
Index: /trunk/platform/ixus70_sd1000/sub/101b/stubs_entry_2.S
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/101b/stubs_entry_2.S	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/101b/stubs_entry_2.S	(revision 511)
@@ -0,0 +1,37 @@
+#include "stubs_asm.h"
+
+NHSTUB(Close,  0xFFA9A008) 
+NHSTUB(DisplayImagePhysicalScreen, 0xFFA25068) 
+NHSTUB(Mount_FileSystem, 0xFFA9932C)	
+NHSTUB(Read,   0xFFA9A09C) 
+NHSTUB(Remove, 0xFFA9A028)
+NHSTUB(Write,  0xFFA9A0A8) 
+NHSTUB(free, 0xFF9201CC)
+NHSTUB(kbd_read_keys_r2, 0xFFA30724) 
+
+NSTUB(GetCurrentAvValue, 0xFFAD9E94)
+
+NHSTUB(AllocateMemory, 0xFF818664)
+NHSTUB(FreeMemory, 0xFF818650)
+NHSTUB(GetFocusLensSubjectDistance, 0xFFAD2FB4) 
+NHSTUB(kbd_pwr_off, 0xFFA30C58)
+NHSTUB(kbd_pwr_on, 0xFFA30C18) 	
+NHSTUB(SetPropertyCase, 0xFF81BB60)
+
+NHSTUB(SetZoomActuatorSpeedPercent, 0xFF9AD778) //null stub
+
+NHSTUB(GetDrive_ClusterSize, 0xFFA997F4)
+NHSTUB(GetDrive_TotalClusters, 0xFFA99830)
+NHSTUB(GetDrive_FreeClusters, 0xFFA9986C)
+
+NHSTUB(MakeAFScan, 0xFFB00050)
+NHSTUB(ExpCtrlTool_StartContiAE, 0xFF96553C)
+NHSTUB(ExpCtrlTool_StopContiAE,  0xFF96556C)
+NHSTUB(GetBatteryTemperature, 0xFFA344E4)
+NHSTUB(GetCCDTemperature, 0xFFA344D0)
+NHSTUB(GetOpticalTemperature, 0xFFA344BC)
+NHSTUB(PT_PlaySound, 0xFFB0B26C)
+
+
+NHSTUB(EnterToCompensationEVF, 0xffafaae0) 
+NHSTUB(ExitFromCompensationEVF, 0xffafab64) 
Index: /trunk/platform/ixus70_sd1000/sub/101b/boot.c
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/101b/boot.c	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/101b/boot.c	(revision 511)
@@ -0,0 +1,165 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+const long new_sa = MEMISOSTART + MEMISOSIZE;
+
+/* Ours stuff */
+extern long wrs_kernel_bss_start;
+extern long wrs_kernel_bss_end;
+extern void createHook (void *pNewTcb);
+extern void deleteHook (void *pTcb);
+
+
+void boot();
+
+/* "relocated" functions */
+void __attribute__((naked,noinline)) h_usrInit();
+void __attribute__((naked,noinline)) h_usrKernelInit();
+void __attribute__((naked,noinline)) h_usrRoot();
+
+
+
+void boot()
+{
+    long *canon_data_src = (void*)0xFFB87FA0; 
+    long *canon_data_dst = (void*)0x1900; 
+    long canon_data_len = 0xCA00; 
+    long *canon_bss_start = (void*)0xE300; 
+    long canon_bss_len = 0xBEF70 - 0xE300; 
+    long i;
+
+    asm volatile (
+	"MRC     p15, 0, R0,c1,c0\n"
+	"ORR     R0, R0, #0x1000\n"
+	"ORR     R0, R0, #4\n"
+	"ORR     R0, R0, #1\n"
+	"MCR     p15, 0, R0,c1,c0\n"
+    :::"r0");
+
+    for(i=0;i<canon_data_len/4;i++)
+	canon_data_dst[i]=canon_data_src[i];
+
+    for(i=0;i<canon_bss_len/4;i++)
+	canon_bss_start[i]=0;
+
+    asm volatile (
+	"MRC     p15, 0, R0,c1,c0\n"
+	"ORR     R0, R0, #0x1000\n"
+	"BIC     R0, R0, #4\n"
+	"ORR     R0, R0, #1\n"
+	"MCR     p15, 0, R0,c1,c0\n"
+    :::"r0");
+
+    h_usrInit();
+}
+
+
+void h_usrInit()
+{
+    asm volatile (
+	"STR     LR, [SP,#-4]!\n"
+	"BL      sub_FF811968\n"
+	"MOV     R0, #2\n"
+	"MOV     R1, R0\n"
+	"BL      sub_FF919D64\n" //unknown_libname_230
+	"BL      sub_FF90DE5C\n" //excVecInit
+	"BL      sub_FF8111C4\n"
+	"BL      sub_FF811728\n"
+	"LDR     LR, [SP],#4\n"
+	"B       h_usrKernelInit\n"
+    );
+}
+
+void  h_usrKernelInit()
+{
+    asm volatile (
+	"STMFD   SP!, {R4,LR}\n"
+	"SUB     SP, SP, #8\n"
+	"BL      sub_FF91A264\n" //classLibInit
+	"BL      sub_FF92A390\n" //taskLibInit
+	"LDR     R3, =0x59C0\n"
+	"LDR     R2, =0xBBFE0\n"
+	"LDR     R1, [R3]\n"
+	"LDR     R0, =0xBCC30\n"
+	"MOV     R3, #0x100\n"
+	"BL      sub_FF925F80\n" //qInit
+	"LDR     R3, =0x5980\n"
+	"LDR     R0, =0x5D20\n"
+	"LDR     R1, [R3]\n"
+	"BL      sub_FF925F80\n" //qInit
+	"LDR     R3, =0x5A3C\n"
+	"LDR     R0, =0xBCC04\n"
+	"LDR     R1, [R3]\n"
+	"BL      sub_FF925F80\n" //qInit
+	"BL      sub_FF92E74C\n" //workQInit
+	"BL      sub_FF8112AC\n"
+	"MOV     R4, #0\n"
+	"MOV     R3, R0\n"
+	"MOV     R12, #0x800\n"
+	"LDR     R0, =h_usrRoot\n" // R0, =sub_FF811A60 (h_usrRoot))
+	"MOV     R1, #0x4000\n"
+    );    
+//	"LDR     R2, =0xEEF70\n" // 0xBEF70 + 0x30000
+    asm volatile (
+        "LDR     R2, =new_sa\n"
+        "LDR     R2, [R2]\n"
+    );
+    asm volatile (
+	"STR     R12, [SP]\n"
+	"STR     R4, [SP,#4]\n"
+	"BL      sub_FF9275D0\n" //kernelInit
+	"ADD     SP, SP, #8\n"
+	"LDMFD   SP!, {R4,PC}\n"
+    );
+}
+
+static long drv_struct[16];
+ 
+static long dh_err()
+{
+    return -1;
+}
+
+static void drv_self_hide()
+{
+    long drvnum;
+    
+    drvnum = _iosDrvInstall(dh_err,dh_err,dh_err,dh_err,dh_err,dh_err,dh_err);
+    if (drvnum >= 0)
+	_iosDevAdd(drv_struct, "A/DISKBOOT.BIN", drvnum);
+}
+
+
+void  h_usrRoot()
+{
+    asm volatile (
+	"STMFD   SP!, {R4,R5,LR}\n"
+	"MOV     R5, R0\n"
+	"MOV     R4, R1\n"
+	"BL      sub_FF8119D0\n"
+	"MOV     R1, R4\n"
+	"MOV     R0, R5\n"
+	"BL      sub_FF91ED1C\n" //memInit
+	"MOV     R1, R4\n"
+	"MOV     R0, R5\n"
+	"BL      sub_FF91F794\n" //memPartLibInit
+//	"BL      sub_FF8117E8\n" //nullSub_1
+	"BL      sub_FF811704\n"
+	"BL      sub_FF811A0C\n"
+	"BL      sub_FF8119F0\n"
+	"BL      sub_FF811A38\n"
+	"BL      sub_FF8119C4\n"
+    );
+
+    _taskCreateHookAdd(createHook);
+    _taskDeleteHookAdd(deleteHook);
+
+    drv_self_hide();
+
+    asm volatile (
+	"LDMFD   SP!, {R4,R5,LR}\n"
+	"B       sub_FF81136C\n" //IsEmptyWriteCache_2
+    );
+}
+
Index: /trunk/platform/ixus70_sd1000/sub/101b/stubs_min.S
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/101b/stubs_min.S	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/101b/stubs_min.S	(revision 511)
@@ -0,0 +1,15 @@
+#include "stubs_asm.h"
+
+DEF(physw_status, 0x564B0) // find in "PhySw"
+DEF(physw_run, 0x87B4) // find in "PhySw"
+
+DEF(zoom_busy, 0x96804) // find in "ZoomLens"
+DEF(focus_busy, 0x95F50) // find in "FocusLens"
+DEF(playrec_mode,0xD0CC) // BL      unknown_libname_797 found in "taskcreate_SsStartupTask"
+DEF(FlashParamsTable,0xFFB3E43C) 
+DEF(canon_menu_active,0x3760) // found in "StartRecModeMenu"
+DEF(canon_shoot_menu_active,0x27C9) // (0x27CC - 0x4 + 0x1) found in "taskcreate_DSITask"
+DEF(recreview_hold, 0x25AC) // (0x25B0 - 0x4) found in "AR:Snd:0x%04x"
+DEF(zoom_status, 0x2680)
+DEF(movie_status, 0xBB558)
+DEF(some_flag_for_af_scan, 0xCDB4)
Index: /trunk/platform/ixus70_sd1000/sub/101b/makefile.inc
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/101b/makefile.inc	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/101b/makefile.inc	(revision 511)
@@ -0,0 +1,15 @@
+#0x314F
+PLATFORMID=12623
+
+PLATFORMOS=vxworks
+
+MEMBASEADDR=0x1900
+RESTARTSTART=0x50000
+MEMISOSTART=0xBEF70
+MEMISOSIZE=0x55000
+ROMBASEADDR=0xff810000
+
+TARGET_PRIMARY=$(topdir)platform/$(PLATFORM)/sub/$(PLATFORMSUB)/PRIMARY.BIN
+
+PLFLAGS=-DMEMBASEADDR=$(MEMBASEADDR) -DMEMISOSTART=$(MEMISOSTART) -DMEMISOSIZE=$(MEMISOSIZE)
+PLFLAGS+=-DRESTARTSTART=$(RESTARTSTART)
Index: /trunk/platform/ixus70_sd1000/sub/101b/stubs_asm.h
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/101b/stubs_asm.h	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/101b/stubs_asm.h	(revision 511)
@@ -0,0 +1,20 @@
+    .text
+
+#define DEF(n,a) \
+    .globl n; n = a
+
+#define NSTUB(name, addr)\
+    .globl _##name ;\
+    .weak _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define NHSTUB(name, addr)\
+    .globl _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define STUB(addr)\
+    .globl sub_ ## addr ;\
+    sub_ ## addr: ;\
+	ldr  pc, =0x ## addr
Index: /trunk/platform/ixus70_sd1000/sub/101b/lib.c
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/101b/lib.c	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/101b/lib.c	(revision 511)
@@ -0,0 +1,75 @@
+#include "platform.h"
+#include "keyboard.h"
+
+void *hook_raw_fptr()
+{
+    return (void*)0; 
+}
+
+void *hook_raw_ret_addr()
+{
+    return (void*)0; 
+}
+
+char *hook_raw_image_addr()
+{
+    return (char*)0x10E706A0; 
+}
+
+long hook_raw_size()
+{
+    return 0x8CAE10; 
+}
+
+void *vid_get_viewport_live_fb()
+{
+//    return (void*)0; 
+    void **fb=(void **)0x6F8C;
+    unsigned char buff = *((unsigned char*)0x6F9C);
+    if (buff == 0) {
+        buff = 2;
+    }
+    else {
+        buff--;
+    }
+    return fb[buff];
+}
+
+void *vid_get_bitmap_fb()
+{
+    return (void*)0x10361000; 
+}
+
+void *vid_get_viewport_fb()
+{
+    return (void*)(0x1065BA50); 
+}
+
+void *vid_get_viewport_fb_d()
+{
+    return (void*)(*(int*)0x94408); 
+}
+
+long vid_get_bitmap_screen_width()
+{
+    return 360;
+}
+
+long vid_get_bitmap_screen_height()
+{
+    return 240;
+}
+
+long vid_get_viewport_height()
+{
+    return ((mode_get()&MODE_MASK) == MODE_PLAY)?240:230;
+}
+char *camera_jpeg_count_str()
+{
+    return (char*)0x12298;
+}
+
+long vid_get_bitmap_buffer_width() { return 360; }
+
+long vid_get_bitmap_buffer_height() { return 240; }
+
Index: /trunk/platform/ixus70_sd1000/sub/101b/movie_rec.c
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/101b/movie_rec.c	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/101b/movie_rec.c	(revision 511)
@@ -0,0 +1,358 @@
+	#include "conf.h"
+
+int *video_quality = &conf.video_quality;
+int *video_mode    = &conf.video_mode;
+
+long def_table1[9]={0x2000,0x38D,0x788,0x5800,0x9C5,0x14B8,0x10000,0x1C6A,0x3C45};
+long def_table2[9]={0x1CCD,-0x2E1,-0x579,0x4F33,-0x7EB,-0xF0C,0xE666,-0x170A,-0x2BC6};
+
+long table1[9], table2[9];
+
+void change_video_tables(int a, int b){
+ int i;
+ for (i=0;i<9;i++) {table1[i]=(def_table1[i]*a)/b; table2[i]=(def_table2[i]*a)/b;}
+}
+
+long CompressionRateTable[]={0x60, 0x5D, 0x5A, 0x57, 0x54, 0x51, 0x4D, 0x48, 0x42, 0x3B, 0x32, 0x29, 0x22, 0x1D, 0x17, 0x14, 0x10, 0xE, 0xB, 9, 7, 6, 5, 4, 3, 2, 1};
+
+void __attribute__((naked,noinline)) movie_record_task(){
+ asm volatile(
+                "STMFD   SP!, {R4,R5,LR}\n"
+                "SUB     SP, SP, #4\n"
+                "MOV     R5, SP\n"
+                "MOV     R4, #0\n"
+"loc_FFB815B0:\n"
+                "LDR     R3, =0xBB420\n"
+                "MOV     R2, #0\n"
+                "LDR     R0, [R3]\n"
+                "MOV     R1, R5\n"
+                "BL      sub_FFB1358C\n"
+                "LDR     R3, =0xBB540\n"
+                "LDR     R2, [R3]\n"
+                "CMP     R2, #0\n"
+                "BNE     loc_FFB8165C\n"
+                "LDR     R1, [SP]\n"
+                "LDR     R3, [R1]\n"
+                "SUB     R3, R3, #2\n"
+                "MOV     R0, R1\n"
+                "CMP     R3, #9\n"
+                "LDRLS   PC, [PC,R3,LSL#2]\n"
+                "B       loc_FFB81660\n"
+                ".long loc_FFB81620\n"
+                ".long loc_FFB81638\n"
+                ".long loc_FFB81640\n"
+                ".long loc_FFB81648\n"
+                ".long loc_FFB81628\n"
+                ".long loc_FFB81650\n"
+                ".long loc_FFB81630\n"
+                ".long loc_FFB81660\n"
+                ".long loc_FFB81658\n"
+                ".long loc_FFB81618\n"
+"loc_FFB81618:\n"
+                "BL      sub_FFB816CC\n"
+                "B       loc_FFB8165C\n"
+"loc_FFB81620:\n"
+                "BL      unlock_optical_zoom\n"
+                "BL      sub_FFB818D4\n"
+                "B       loc_FFB8165C\n"
+"loc_FFB81628:\n"
+                "BL      sub_FFB81CB4_my\n"  //----------->
+                "B       loc_FFB8165C\n"
+"loc_FFB81630:\n"
+                "BL      sub_FFB82544\n"
+                "B       loc_FFB8165C\n"
+"loc_FFB81638:\n"
+                "BL      sub_FFB81FF8\n"
+                "B       loc_FFB8165C\n"
+"loc_FFB81640:\n"
+                "BL      sub_FFB826E0\n"
+                "B       loc_FFB8165C\n"
+"loc_FFB81648:\n"
+                "BL      sub_FFB828C0\n"
+                "B       loc_FFB8165C\n"
+"loc_FFB81650:\n"
+                "BL      sub_FFB825CC\n"
+                "B       loc_FFB8165C\n"
+"loc_FFB81658:\n"
+                "BL      sub_FFB82048\n"
+"loc_FFB8165C:\n"
+                "LDR     R1, [SP]\n"
+"loc_FFB81660:\n"
+                "LDR     R3, =0xBB424\n"
+                "STR     R4, [R1]\n"
+                "LDR     R0, [R3]\n"
+                "MOV     R2, R4\n"
+                "BL      sub_FFB139A4\n"
+                "B       loc_FFB815B0\n"
+ );
+}
+
+void __attribute__((naked,noinline)) sub_FFB81CB4_my(){
+ asm volatile(
+                "STMFD   SP!, {R4-R11,LR}\n"
+                "LDR     R7, =0xBB558\n"
+                "SUB     SP, SP, #0x3C\n"
+                "LDR     R3, [R7]\n"
+                "MOV     R5, #0\n"
+                "CMP     R3, #3\n"
+                "MOV     R4, R0\n"
+                "STR     R5, [SP,#0x34]\n"
+                "STR     R5, [SP,#0x2C]\n"
+                "MOV     R6, #1\n"
+                "MOVEQ   R3, #4\n"
+                "STREQ   R3, [R7]\n"
+                "LDR     R3, =0xBB604\n"
+                "MOV     LR, PC\n"
+                "LDR     PC, [R3]\n"
+                "LDR     R2, [R7]\n"
+                "CMP     R2, #4\n"
+                "BNE     loc_FFB81F10\n"
+                "LDR     R3, =0xBB646\n"
+                "LDRH    R2, [R3]\n"
+                "CMP     R2, #1\n"
+                "BNE     loc_FFB81D44\n"
+                "LDR     R2, =0xBB568\n"
+                "LDR     R1, =0xBB648\n"
+                "LDR     R0, [R2]\n"
+                "LDRH    R3, [R1]\n"
+                "MUL     R12, R3, R0\n"
+                "LDR     R2, =0x10624DD3\n"
+                "UMULL   R3, R1, R2, R12\n"
+                "LDR     R3, =0xBB584\n"
+                "MOV     R1, R1,LSR#6\n"
+                "LDR     R0, [R3]\n"
+                "BL      sub_FF914660\n"
+                "CMP     R0, #0\n"
+                "MOVNE   R6, #0\n"
+                "MOVEQ   R6, #1\n"
+"loc_FFB81D44:\n"
+                "CMP     R6, #1\n"
+                "BNE     loc_FFB81D64\n"
+                "ADD     R0, SP, #0x38\n"
+                "ADD     R1, SP, #0x34\n"
+                "ADD     R2, SP, #0x30\n"
+                "ADD     R3, SP, #0x2C\n"
+                "BL      sub_FFB8347C\n"
+                "MOV     R5, R0\n"
+"loc_FFB81D64:\n"
+                "CMP     R5, #0\n"
+                "BNE     loc_FFB81D94\n"
+                "LDR     R3, =0xBB548\n"
+                "LDR     R2, [R3]\n"
+                "CMP     R2, #1\n"
+                "BNE     loc_FFB81DA8\n"
+                "LDR     R2, =0xBB584\n"
+                "LDR     R1, =0xBB55C\n"
+                "LDR     R0, [R2]\n"
+                "LDR     R3, [R1]\n"
+                "CMP     R0, R3\n"
+                "BCC     loc_FFB81DA8\n"
+"loc_FFB81D94:\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FFB81F70\n"
+                "BL      sub_FFB82504\n"
+                "MOV     R3, #5\n"
+                "B       loc_FFB81F0C\n"
+"loc_FFB81DA8:\n"
+                "LDR     R9, [SP,#0x34]\n"
+                "CMP     R9, #0\n"
+                "BEQ     loc_FFB81E90\n"
+                "LDR     R7, =0xBB5A0\n"
+                "LDR     R12, =0xBB58C\n"
+                "LDMIB   R4, {R0-R2}\n"
+                "LDR     R10, [R4,#0x18]\n"
+                "LDR     R6, [R7]\n"
+                "LDR     R7, [R4,#0x14]\n"
+                "LDR     R4, =0xBB54C\n"
+                "LDR     R8, [R12]\n"
+                "ADD     R5, SP, #0x2C\n"
+                "LDMIA   R5, {R5,LR}\n"
+                "MOV     R11, #1\n"
+                "LDR     R3, [SP,#0x38]\n"
+                "ADD     R12, SP, #0x28\n"
+                "STR     R11, [R4]\n"
+                "ADD     R4, SP, #0x24\n"
+                "STMEA   SP, {R9,LR}\n"
+                "STR     R5, [SP,#8]\n"
+                "STR     R12, [SP,#0xC]\n"
+                "STR     R8, [SP,#0x10]\n"
+                "STR     R6, [SP,#0x14]\n"
+                "STR     R7, [SP,#0x18]\n"
+                "STR     R10, [SP,#0x1C]\n"
+                "STR     R4, [SP,#0x20]\n"
+                "BL      sub_FFB86528\n"
+                "LDR     R3, =0xBB418\n"
+                "MOV     R1, #0x3E8\n"
+                "LDR     R0, [R3]\n"
+                "BL      sub_FFB14154\n"
+                "CMP     R0, #9\n"
+                "BNE     loc_FFB81E3C\n"
+                "BL      sub_FFB83D0C\n"
+                "LDR     R3, =0xBB558\n"
+                "LDR     R0, =0xFFB81C9C\n"
+                "B       loc_FFB81E54\n"
+"loc_FFB81E3C:\n"
+                "LDR     R4, [SP,#0x24]\n"
+                "CMP     R4, #0\n"
+                "BEQ     loc_FFB81E60\n"
+                "BL      sub_FFB83D0C\n"
+                "LDR     R3, =0xBB558\n"
+                "LDR     R0, =0xFFB81CA8\n"
+"loc_FFB81E54:\n"
+                "STR     R11, [R3]\n"
+                "BL      sub_FFB36F08\n"
+                "B       loc_FFB81F10\n"
+"loc_FFB81E60:\n"
+                "BL      sub_FFB866A4\n"
+                "LDR     R0, [SP,#0x38]\n"
+                "LDR     R1, [SP,#0x28]\n"
+                "BL      sub_FFB83964\n"
+                "LDR     R12, =0xBB580\n"
+                "LDR     R3, [R12]\n"
+                "ADD     R3, R3, #1\n"
+                "LDR     R0, [SP,#0x28]\n"
+                "LDR     R1, =0xBB5A0\n"
+                "MOV     R2, R4\n"
+                "STR     R3, [R12]\n"
+                "BL      sub_FFAF2BC4_my\n"  //-------------->
+"loc_FFB81E90:\n"
+                "LDR     R4, =0xBB584\n"
+                "LDR     R2, =0xBB5AC\n"
+                "LDR     R3, [R4]\n"
+                "LDR     R1, [R2]\n"
+                "LDR     R12, =0xBB5A8\n"
+                "ADD     R3, R3, #1\n"
+                "MUL     R0, R1, R3\n"
+                "LDR     R1, [R12]\n"
+                "STR     R3, [R4]\n"
+                "BL      sub_FF9145C8\n"
+                "LDR     R6, =0xBB5A4\n"
+                "MOV     R4, R0\n"
+                "BL      sub_FFB83D48\n"
+                "LDR     R3, [R6]\n"
+                "CMP     R3, R4\n"
+                "BNE     loc_FFB81EE4\n"
+                "LDR     R5, =0xBB550\n"
+                "LDR     R3, [R5]\n"
+                "CMP     R3, #1\n"
+                "BNE     loc_FFB81F04\n"
+                "B       loc_FFB81EE8\n"
+"loc_FFB81EE4:\n"
+                "LDR     R5, =0xBB550\n"
+"loc_FFB81EE8:\n"
+                "LDR     R2, =0xBB5E8\n"
+                "MOV     R0, R4\n"
+                "MOV     LR, PC\n"
+                "LDR     PC, [R2]\n"
+                "MOV     R3, #0\n"
+                "STR     R3, [R5]\n"
+                "STR     R4, [R6]\n"
+"loc_FFB81F04:\n"
+                "LDR     R7, =0xBB54C\n"
+                "MOV     R3, #0\n"
+"loc_FFB81F0C:\n"
+                "STR     R3, [R7]\n"
+"loc_FFB81F10:\n"
+                "ADD     SP, SP, #0x3C\n"
+                "LDMFD   SP!, {R4-R11,PC}\n"
+
+ );
+}
+
+void __attribute__((naked,noinline)) sub_FFAF2BC4_my(){
+ asm volatile(
+                "STMFD   SP!, {R4-R8,LR}\n"
+                "LDR     R12, =0x96ED4\n"
+                "LDR     R4, [R12]\n"
+                "LDR     R3, =0x96EDC\n"
+                "CMP     R4, #0\n"
+                "MOV     R8, R1\n"
+                "MOV     R7, R0\n"
+                "LDR     R1, [R3]\n"
+                "BEQ     loc_FFAF2BFC\n"
+                "LDR     R2, =0x96EE0\n"
+                "LDR     R3, [R2]\n"
+                "CMP     R3, #1\n"
+                "BNE     loc_FFAF2C10\n"
+                "B       loc_FFAF2C00\n"
+"loc_FFAF2BFC:\n"
+                "LDR     R2, =0x96EE0\n"
+"loc_FFAF2C00:\n"
+                "MOV     R3, #0\n"
+                "STR     R3, [R2]\n"
+                "STR     R7, [R12]\n"
+                "B       loc_FFAF2CC8\n"
+"loc_FFAF2C10:\n"
+                "LDR     R2, =0x96ED8\n"
+                "LDR     R3, [R2]\n"
+                "LDR     R6, =table1\n" // 0xFFAF2AC8
+                "ADD     R3, R3, R3,LSL#1\n"
+                "MOV     LR, R3,LSL#2\n"
+                "LDR     R2, [R6,LR]\n"
+                "LDR     R5, =table2\n" // 0xFFAF2AEC
+                "RSB     R12, R2, R4\n"
+                "LDR     R3, [R5,LR]\n"
+                "CMP     R12, #0\n"
+                "RSB     R0, R3, R4\n"
+                "BLE     loc_FFAF2C74\n"
+                "ADD     R3, R6, #4\n"
+                "LDR     R2, [R3,LR]\n"
+                "CMP     R2, R12\n"
+                "ADDGE   R1, R1, #1\n"
+                "BGE     loc_FFAF2C68\n"
+                "ADD     R3, R6, #8\n"
+                "LDR     R2, [R3,LR]\n"
+                "CMP     R2, R12\n"
+                "ADDGE   R1, R1, #2\n"
+                "ADDLT   R1, R1, #3\n"
+"loc_FFAF2C68:\n"
+          //    "CMP     R1, #0x16\n"
+          //    "MOVGE   R1, #0x16\n"
+                "CMP     R1, #0x1A\n"     // + 
+                "MOVGE   R1, #0x1A\n"     // + 
+
+                "B       loc_FFAF2CAC\n"
+"loc_FFAF2C74:\n"
+                "CMP     R0, #0\n"
+                "BGE     loc_FFAF2CAC\n"
+                "ADD     R3, R5, #4\n"
+                "LDR     R2, [R3,LR]\n"
+                "CMP     R2, R0\n"
+                "SUBLE   R1, R1, #1\n"
+                "BLE     loc_FFAF2CA4\n"
+                "ADD     R3, R5, #8\n"
+                "LDR     R2, [R3,LR]\n"
+                "CMP     R2, R0\n"
+                "SUBLE   R1, R1, #2\n"
+                "SUBGT   R1, R1, #3\n"
+"loc_FFAF2CA4:\n"
+                "CMP     R1, #0\n"
+                "MOVLT   R1, #0\n"
+"loc_FFAF2CAC:\n"
+                "LDR     R0, =0x96EDC\n"
+                "LDR     R3, [R0]\n"
+                "CMP     R1, R3\n"
+                "LDRNE   R2, =0x96EE0\n"
+                "MOVNE   R3, #1\n"
+                "STRNE   R1, [R0]\n"
+                "STRNE   R3, [R2]\n"
+"loc_FFAF2CC8:\n"
+                "LDR     R3, =0x96EDC\n"
+                "LDR     R2, =CompressionRateTable\n" 
+                "LDR     R1, [R3]\n"
+                "LDR     R0, =0x96ED4\n"
+                "LDR     R3, [R2,R1,LSL#2]\n"
+
+                "LDR     R1, =video_mode\n"      // +
+                "LDR     R1, [R1]\n"             // +
+                "LDR     R1, [R1]\n"             // +
+                "CMP     R1, #1\n"               // +
+                "LDREQ   R1, =video_quality\n"   // +     
+                "LDREQ   R1, [R1]\n"             // +     
+                "LDREQ   R3, [R1]\n"             // +     
+
+                "STR     R7, [R0]\n"
+                "STR     R3, [R8]\n"
+                "LDMFD   SP!, {R4-R8,PC}\n"
+ );
+}
Index: /trunk/platform/ixus70_sd1000/sub/101b/stubs_auto.S
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/101b/stubs_auto.S	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/101b/stubs_auto.S	(revision 511)
@@ -0,0 +1,93 @@
+/* THIS FILE IS GENERATED */
+/* DO NOT EDIT THIS FILE! */
+
+#include "stubs_asm.h"
+
+STUB(FF8111C4)
+STUB(FF8112AC)
+STUB(FF81136C)
+STUB(FF811704)
+STUB(FF811728)
+STUB(FF8117E8)
+STUB(FF811968)
+STUB(FF8119C4)
+STUB(FF8119D0)
+STUB(FF8119F0)
+STUB(FF811A0C)
+STUB(FF811A38)
+STUB(FF81BC98)
+STUB(FF81BE94)
+STUB(FF8261B8)
+STUB(FF90DE5C)
+STUB(FF9145C8)
+STUB(FF914660)
+STUB(FF919D64)
+STUB(FF91A264)
+STUB(FF91ED1C)
+STUB(FF91F794)
+STUB(FF925F80)
+STUB(FF9275D0)
+STUB(FF92A390)
+STUB(FF92E74C)
+STUB(FFA395F0)
+STUB(FFAF2BC4)
+STUB(FFAFCE88)
+STUB(FFAFD400)
+STUB(FFAFEA58)
+STUB(FFAFEB7C)
+STUB(FFAFEC58)
+STUB(FFAFED34)
+STUB(FFAFEE10)
+STUB(FFAFF378)
+STUB(FFAFF730)
+STUB(FFAFF740)
+STUB(FFAFF750)
+STUB(FFAFF778)
+STUB(FFAFF890)
+STUB(FFAFF900)
+STUB(FFAFF998)
+STUB(FFAFFAEC)
+STUB(FFB00934)
+STUB(FFB01068)
+STUB(FFB0123C)
+STUB(FFB012D0)
+STUB(FFB013CC)
+STUB(FFB0150C)
+STUB(FFB01568)
+STUB(FFB01638)
+STUB(FFB0180C)
+STUB(FFB018A8)
+STUB(FFB01968)
+STUB(FFB01C38)
+STUB(FFB01D18)
+STUB(FFB01E30)
+STUB(FFB01E94)
+STUB(FFB021AC)
+STUB(FFB0270C)
+STUB(FFB028A0)
+STUB(FFB091A8)
+STUB(FFB12E74)
+STUB(FFB13010)
+STUB(FFB1358C)
+STUB(FFB139A4)
+STUB(FFB14154)
+STUB(FFB14B50)
+STUB(FFB2069C)
+STUB(FFB36F08)
+STUB(FFB816CC)
+STUB(FFB818D4)
+STUB(FFB81CB4)
+STUB(FFB81F70)
+STUB(FFB81FF8)
+STUB(FFB82048)
+STUB(FFB82504)
+STUB(FFB82544)
+STUB(FFB825CC)
+STUB(FFB826E0)
+STUB(FFB828C0)
+STUB(FFB8347C)
+STUB(FFB83964)
+STUB(FFB83D0C)
+STUB(FFB83D48)
+STUB(FFB86528)
+STUB(FFB866A4)
Index: /trunk/platform/ixus70_sd1000/sub/101b/Makefile
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/101b/Makefile	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/101b/Makefile	(revision 511)
@@ -0,0 +1,6 @@
+topdir=../../../../
+
+OBJS=boot.o stubs_min.o stubs_auto.o stubs_entry.o lib.o stubs_entry_2.o capt_seq.o movie_rec.o
+STUBS_AUTO_DEPS=boot.c capt_seq.c movie_rec.c
+
+include $(topdir)/platform/makefile_sub.inc
Index: /trunk/platform/ixus70_sd1000/sub/102a/capt_seq.c
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/102a/capt_seq.c	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/102a/capt_seq.c	(revision 511)
@@ -0,0 +1,295 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+#define RAWDATA_AVAILABLE (1)
+#define RAWDATA_SAVED (2)
+
+#define NR_ON (2)
+#define NR_OFF (1)
+
+static long raw_save_stage;
+
+void capt_seq_hook_raw_here()
+{
+    raw_save_stage = RAWDATA_AVAILABLE;
+    core_rawdata_available();
+    while (raw_save_stage != RAWDATA_SAVED){
+	_SleepTask(10);
+    }
+}
+
+void hook_raw_save_complete()
+{
+    raw_save_stage = RAWDATA_SAVED;
+}
+
+
+void capt_seq_hook_set_nr()
+{
+    long *nrflag = (long*)0xCDA0;
+
+    switch (core_get_noise_reduction_value()){
+    case NOISE_REDUCTION_AUTO_CANON:
+	// leave it alone
+	break;
+    case NOISE_REDUCTION_OFF:
+	*nrflag = 1;
+	break;
+    case NOISE_REDUCTION_ON:
+	*nrflag = 2;
+	break;
+    };
+}
+
+
+void __attribute__((naked,noinline)) sub_FFB01EB0_my(long p)
+{
+    asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                "MOV     R4, R0\n"
+                "SUB     SP, SP, #0xC\n"
+                "BL      sub_FFB02920\n"
+//              "MOVL    R1, 0xFFFFFFFF\n"
+                "MVN     R1, #0\n"
+                "BL      sub_FFB13090\n" //ClearEventFlag
+                "MOV     R0, #0x8A\n"
+                "ADD     R1, SP, #4\n"
+                "MOV     R2, #4\n"
+                "BL      sub_FF81BC98\n"
+                "TST     R0, #1\n"
+                "BEQ     loc_FFB01EF0\n"
+                "MOV     R1, #0x1D0\n"
+                "LDR     R0, =0xFFB01D34\n" //aSscaptureseq_c
+                "ADD     R1, R1, #2\n"
+                "BL      sub_FFB2071C\n" //DebugAssert
+"loc_FFB01EF0:\n"                           
+                "LDR     R3, =0xBDA80\n"
+                "LDR     R2, =0xBDB40\n"
+                "LDR     R0, [R3,#0x7C]\n"
+                "LDRSH   R1, [R2,#0xE]\n"
+                "BL      sub_FFA395F0\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FFB01CB8\n"
+                "BL      wait_until_remote_button_is_released\n"
+                "BL      capt_seq_hook_set_nr\n" // +
+                "LDR     R3, =0xCDA4\n"
+                "LDR     R0, [R3]\n"
+
+                "B       sub_FFB01F14\n"  // ---> jump to end of function in ROM
+    );
+}
+
+void __attribute__((naked,noinline)) sub_FFAFECD8_my(long p)
+{
+    asm volatile (
+                "STMFD   SP!, {R4,R5,LR}\n"
+                "LDR     R3, =0xBDA80\n"
+                "LDR     R5, [R0,#0xC]\n"
+                "LDR     R1, [R3,#0x24]\n"
+                "LDR     R2, [R5,#8]\n"
+                "CMP     R1, #0\n"
+                "ORR     R2, R2, #1\n"
+                "STR     R2, [R5,#8]\n"
+                "BNE     loc_FFAFED2C\n"
+                "MOV     R0, #0xC\n"
+                "BL      sub_FFB09228\n"
+                "TST     R0, #1\n"
+                "BEQ     loc_FFAFED2C\n"
+                "LDR     R3, [R5,#8]\n"
+                "MOV     R0, #1\n"
+                "ORR     R3, R3, #0x40000000\n"
+                "STR     R3, [R5,#8]\n"
+"loc_FFAFED1C:\n"                           
+                "MOV     R2, R5\n"
+                "MOV     R1, #1\n"
+                "LDMFD   SP!, {R4,R5,LR}\n"
+                "B       sub_FFAFD480\n"
+ "loc_FFAFED2C:\n"                           
+                "LDR     R4, =0xBDA80\n"
+                "BL      sub_FFAFF7D0\n" //Set_CMD25Write_61
+                "LDR     R3, [R4,#0x24]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FFAFED74\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FFB009B4\n"
+                "TST     R0, #1\n"
+                "BNE     loc_FFAFED1C\n"
+                "BL      sub_FF8261B8\n"
+                "BL      sub_FF81BE94\n"
+                "STR     R0, [R5,#0x14]\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FFB01D98\n"
+                "BL      sub_FFB0278C\n"
+                "MOV     R0, R5\n"
+                "BL      sub_FFB01EB0_my\n"  //---------->
+                "BL      capt_seq_hook_raw_here\n"  // +
+                "B       loc_FFAFED88\n"
+"loc_FFAFED74:\n"
+                "LDR     R3, =0xCD8C\n"
+                "LDR     R2, [R3]\n"
+                "CMP     R2, #0\n"
+                "MOVNE   R0, #0x1D\n"
+                "MOVEQ   R0, #0\n"
+"loc_FFAFED88:\n"
+                "MOV     R1, #1\n"
+                "MOV     R2, R5\n"
+                "BL      sub_FFAFD480\n"
+                "BL      sub_FFB0222C\n"
+                "CMP     R0, #0\n"
+                "LDRNE   R3, [R5,#8]\n"
+                "ORRNE   R3, R3, #0x2000\n"
+                "STRNE   R3, [R5,#8]\n"
+                "LDMFD   SP!, {R4,R5,PC}\n"
+    );
+}
+
+void __attribute__((naked,noinline)) capt_seq_task()
+{
+	asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                "SUB     SP, SP, #4\n"
+                "MOV     R4, SP\n"
+                "B       loc_FFAFF310\n"
+"loc_FFAFF194:\n"                           
+                "LDR     R2, [SP]\n"
+                "LDR     R3, [R2]\n"
+                "MOV     R0, R2\n"
+                "CMP     R3, #0x15\n"
+                "LDRLS   PC, [PC,R3,LSL#2]\n"
+                "B       loc_FFAFF2E4\n"
+                ".long loc_FFAFF204\n"
+                ".long loc_FFAFF224\n"
+                ".long loc_FFAFF238\n"
+                ".long loc_FFAFF24C\n"
+                ".long loc_FFAFF244\n"
+                ".long loc_FFAFF254\n"
+                ".long loc_FFAFF25C\n"
+                ".long loc_FFAFF268\n"
+                ".long loc_FFAFF270\n"
+                ".long loc_FFAFF27C\n"
+                ".long loc_FFAFF284\n"
+                ".long loc_FFAFF28C\n"
+                ".long loc_FFAFF294\n"
+                ".long loc_FFAFF29C\n"
+                ".long loc_FFAFF2A4\n"
+                ".long loc_FFAFF2B0\n"
+                ".long loc_FFAFF2B8\n"
+                ".long loc_FFAFF2C0\n"
+                ".long loc_FFAFF2C8\n"
+                ".long loc_FFAFF2D4\n"
+                ".long loc_FFAFF2DC\n"
+                ".long loc_FFAFF2F8\n"
+"loc_FFAFF204:\n"                           
+                                        
+                "BL      sub_FFAFF7F8\n"
+                "BL      shooting_expo_param_override\n"   // +
+                "BL      sub_FFAFCF08\n"
+                "LDR     R3, =0xBDA80\n"
+                "LDR     R2, [R3,#0x24]\n"
+                "CMP     R2, #0\n"
+                "BEQ     loc_FFAFF2F4\n"
+                "BL      sub_FFAFEDB4\n"
+                "B       loc_FFAFF2F4\n"
+"loc_FFAFF224:\n"                           
+                                        
+                "BL      sub_FFAFECD8_my\n"  //--------->
+
+"loc_FFAFF228:\n"                           
+                "LDR     R2, =0xBDA80\n"                       
+                "MOV     R3, #0\n"
+                "STR     R3, [R2,#0x24]\n"
+                "B       loc_FFAFF2F4\n"
+"loc_FFAFF238:\n"                           
+                "MOV     R0, #1\n"                        
+                "BL      sub_FFAFFA18\n" //jumptable case 2
+                "B       loc_FFAFF2F4\n"
+"loc_FFAFF244:\n"                           
+                "BL      sub_FFAFF3F8\n" //jumptable case 4
+                "B       loc_FFAFF228\n"
+"loc_FFAFF24C:\n"                           
+                "BL      sub_FFAFF7B0\n" //BackLightDrv_LcdBackLightOff_15
+                "B       loc_FFAFF228\n"
+"loc_FFAFF254:\n"                           
+                "BL      sub_FFAFF7C0\n" //jumptable case 5
+                "B       loc_FFAFF2F4\n"
+"loc_FFAFF25C:\n"                           
+                "BL      sub_FFAFF910\n" //jumptable case 6                        
+                "BL      sub_FFAFCF08\n"
+                "B       loc_FFAFF2F4\n"
+"loc_FFAFF268:\n"                           
+                "BL      sub_FFAFEE90\n" //jumptable case 7
+                "B       loc_FFAFF2F4\n"
+"loc_FFAFF270:\n"                           
+                "BL      sub_FFAFF980\n" //jumptable case 8                        
+                "BL      sub_FFAFCF08\n"
+                "B       loc_FFAFF2F4\n"
+"loc_FFAFF27C:\n"                           
+                "BL      sub_FFAFF7B0\n" //BackLightDrv_LcdBackLightOff_15
+                "B       loc_FFAFF2F4\n"
+"loc_FFAFF284:\n"                           
+                "BL      sub_FFB010E8\n" //jumptable case 10
+                "B       loc_FFAFF2F4\n"
+"loc_FFAFF28C:\n"                           
+                "BL      sub_FFB012BC\n" //jumptable case 11
+                "B       loc_FFAFF2F4\n"
+"loc_FFAFF294:\n"                           
+                "BL      sub_FFB01350\n" //jumptable case 12
+                "B       loc_FFAFF2F4\n"
+"loc_FFAFF29C:\n"                           
+                "BL      sub_FFB0144C\n" //jumptable case 13
+                "B       loc_FFAFF2F4\n"
+"loc_FFAFF2A4:\n"                           
+                "MOV     R0, #0\n"                        
+                "BL      sub_FFB016B8\n" //jumptable case 14
+                "B       loc_FFAFF2F4\n"
+"loc_FFAFF2B0:\n"                           
+                "BL      sub_FFB0188C\n" //jumptable case 15
+                "B       loc_FFAFF2F4\n"
+"loc_FFAFF2B8:\n"                           
+                "BL      sub_FFB01928\n" //jumptable case 16
+                "B       loc_FFAFF2F4\n"
+"loc_FFAFF2C0:\n"                           
+                "BL      sub_FFB019E8\n" //jumptable case 17
+                "B       loc_FFAFF2F4\n"
+"loc_FFAFF2C8:\n"                           
+                "BL      sub_FFAFFB6C\n" //jumptable case 18                        
+                "BL      sub_FFAFEBFC\n"
+                "B       loc_FFAFF2F4\n"
+"loc_FFAFF2D4:\n"                           
+                "BL      sub_FFB0158C\n" //jumptable case 19
+                "B       loc_FFAFF2F4\n"
+"loc_FFAFF2DC:\n" 
+                "BL      sub_FFB015E8\n" //jumptable case 20
+                "B       loc_FFAFF2F4\n"
+"loc_FFAFF2E4:\n"                         
+                "MOV     R1, #0x4C0\n"
+                "LDR     R0, =0xFFAFEA58\n" //aSsshoottask_c
+                "ADD     R1, R1, #0xE\n"
+                "BL      sub_FFB2071C\n" //DebugAssert
+"loc_FFAFF2F4:\n"                           
+                "LDR     R2, [SP]\n"
+"loc_FFAFF2F8:\n"                           
+                "LDR     R3, =0x97348\n" //jumptable case 21
+                "LDR     R1, [R2,#4]\n"
+                "LDR     R0, [R3]\n"
+                "BL      sub_FFB12EF4\n" //SetEventFlag
+                "LDR     R0, [SP]\n"
+                "BL      sub_FFAFEAD8\n"
+"loc_FFAFF310:\n"                           
+                "LDR     R3, =0x9734C\n"
+                "MOV     R1, R4\n"
+                "LDR     R0, [R3]\n"
+                "MOV     R2, #0\n"
+                "BL      sub_FFB1360C\n" //ReceiveMessageQueue
+                "TST     R0, #1\n"
+                "BEQ     loc_FFAFF194\n"
+                "LDR     R0, =0xFFAFEA58\n" //aSsshoottask_c
+                "MOV     R1, #0x400\n"
+                "BL      sub_FFB2071C\n" //DebugAssert
+                "BL      sub_FFB14BD0\n"
+                "ADD     SP, SP, #4\n"
+                "LDMFD   SP!, {R4,PC}\n"
+	);
+}
+
Index: /trunk/platform/ixus70_sd1000/sub/102a/stubs_entry.S
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/102a/stubs_entry.S	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/102a/stubs_entry.S	(revision 511)
@@ -0,0 +1,183 @@
+// !!! THIS FILE IS GENERATED. DO NOT EDIT. !!!
+#include "stubs_asm.h"
+
+// Best match: 95%
+NSTUB(AllocateMemory, 0xff811e34)
+// ALT: NSTUB(AllocateMemory, 0xff811e34) // 23/1
+NSTUB(AllocateUncacheableMemory, 0xff81e5a4)
+// ERROR: Close is not found!
+// Best match: 93%
+NSTUB(CreatePhysicalVram, 0xffa25e0c)
+NSTUB(CreateTask, 0xffb14810)
+NSTUB(CreateTaskStrict, 0xffb158b0)
+NSTUB(DisableDispatch, 0xffb14634)
+// ERROR: DisplayImagePhysicalScreen is not found!
+NSTUB(EnableDispatch, 0xffb146c0)
+NSTUB(ExecuteEventProcedure, 0xff814a58)
+NSTUB(ExitTask, 0xffb14bd0)
+NSTUB(Fclose_Fut, 0xffa95750)
+NSTUB(Fopen_Fut, 0xffa95710)
+NSTUB(Fread_Fut, 0xffa9580c)
+// Best match: 95%
+NSTUB(FreeMemory, 0xff811e40)
+// ALT: NSTUB(FreeMemory, 0xff811e40) // 23/1
+// Best match: 90%
+NSTUB(FreeUncacheableMemory, 0xff81e5d8)
+NSTUB(Fseek_Fut, 0xffa95900)
+NSTUB(Fwrite_Fut, 0xffa95860)
+NSTUB(GetCurrentAvValue, 0xffa50268)
+// ALT: NSTUB(GetCurrentAvValue, 0xffa52838) // 13/0
+NSTUB(GetCurrentTargetDistance, 0xffa527e0)
+// Best match: 90%
+NSTUB(GetFocusLensSubjectDistance, 0xffad2fb4)
+// ALT: NSTUB(GetFocusLensSubjectDistance, 0xffad2fb4) // 28/3
+NSTUB(GetFocusLensSubjectDistanceFromLens, 0xffad34a8)
+// Best match: 86%
+NSTUB(GetParameterData, 0xffb39ce0)
+// Best match: 89%
+NSTUB(GetPropertyCase, 0xff81bc98)
+// Best match: 96%
+NSTUB(GetSystemTime, 0xff8136ec)
+// ALT: NSTUB(GetSystemTime, 0xff8136ec) // 26/1
+// Best match: 68%
+NSTUB(GetZoomLensCurrentPoint, 0xffae5ef4)
+// ALT: NSTUB(GetZoomLensCurrentPoint, 0xffae5ef4) // 20/9
+// Best match: 51%
+NSTUB(GetZoomLensCurrentPosition, 0xffae5f08)
+// ALT: NSTUB(GetZoomLensCurrentPosition, 0xffae5f08) // 15/14
+NSTUB(IsStrobeChargeCompleted, 0xff9a43a8)
+NSTUB(LockMainPower, 0xffb36bf4)
+// Best match: 61%
+NSTUB(MakeDirectory, 0xffa9a338)
+// ERROR: Mount_FileSystem is not found!
+// Best match: 73%
+NSTUB(MoveFocusLensToDistance, 0xffa52a78)
+NSTUB(MoveZoomLensWithPoint, 0xffae5dcc)
+// ALT: NSTUB(MoveZoomLensWithPoint, 0xffae5dcc) // 25/0
+// Best match: 66%
+NSTUB(Open, 0xffa99fe0)
+// Best match: 93%
+NSTUB(PhySw_testgpio, 0xffa30ce4)
+NSTUB(ProtectFile, 0xffa94c34)
+// Best match: 92%
+NSTUB(PutInNdFilter, 0xffa5044c)
+// ALT: NSTUB(PutInNdFilter, 0xffa5044c) // 25/2
+// Best match: 94%
+NSTUB(PutOutNdFilter, 0xffa50494)
+// ALT: NSTUB(PutOutNdFilter, 0xffa50494) // 16/1
+// ERROR: Read is not found!
+// Best match: 58%
+NSTUB(RefreshPhysicalScreen, 0xff90bc18)
+// ERROR: Remove is not found!
+NSTUB(SetAutoShutdownTime, 0xffb36af8)
+// Best match: 86%
+NSTUB(SetParameterData, 0xffb39c00)
+// Best match: 73%
+NSTUB(SetPropertyCase, 0xff81bb5c)
+NSTUB(SleepTask, 0xffb14724)
+// Best match: 61%
+NSTUB(TakeSemaphore, 0xffb141dc)
+NSTUB(UnlockMainPower, 0xffb36c8c)
+NSTUB(Unmount_FileSystem, 0xffa993d4)
+// Best match: 89%
+NSTUB(UnsetZoomForMovie, 0xff834a74)
+NSTUB(UpdateMBROnFlash, 0xffa99528)
+// Best match: 96%
+NSTUB(VbattGet, 0xffa2ccd8)
+// ERROR: Write is not found!
+NSTUB(_log, 0xff912db4)
+// ALT: NSTUB(_log, 0xff912db4) // 27/0
+NSTUB(_log10, 0xff90fb5c)
+// ALT: NSTUB(_log10, 0xff90fb5c) // 27/0
+NSTUB(_pow, 0xff90fcdc)
+// ALT: NSTUB(_pow, 0xff90fcdc) // 25/0
+NSTUB(_sqrt, 0xff911b9c)
+// ALT: NSTUB(_sqrt, 0xff911b9c) // 24/0
+NSTUB(chdir, 0xff91d840)
+// ALT: NSTUB(chdir, 0xff91d840) // 27/0
+NSTUB(close, 0xff91d180)
+NSTUB(closedir, 0xffb526c0)
+// ERROR: free is not found!
+NSTUB(ints_disable, 0xffb128c0)
+NSTUB(ints_enable, 0xffb128cc)
+NSTUB(ioctl, 0xff91d2c0)
+NSTUB(iosDevAdd, 0xff91e3a0)
+NSTUB(iosDrvInstall, 0xff91e664)
+NSTUB(isalpha, 0xff914758)
+// ALT: NSTUB(isalpha, 0xff914758) // 4/0
+NSTUB(isdigit, 0xff914788)
+// ALT: NSTUB(isdigit, 0xff914788) // 4/0
+NSTUB(islower, 0xff9147b8)
+// ALT: NSTUB(islower, 0xff9147b8) // 4/0
+NSTUB(isspace, 0xff914800)
+// ALT: NSTUB(isspace, 0xff914800) // 4/0
+NSTUB(isupper, 0xff914818)
+// ALT: NSTUB(isupper, 0xff914818) // 4/0
+NSTUB(kbd_p1_f, 0xffa2f1ec)
+NSTUB(kbd_p1_f_cont, 0xffa2f1f8)
+// Best match: 56%
+NSTUB(kbd_p2_f, 0xffa2f61c)
+// Best match: 83%
+NSTUB(kbd_pwr_off, 0xffa2e504)
+// ALT: NSTUB(kbd_pwr_off, 0xffa2e520) // 5/1
+// ALT: NSTUB(kbd_pwr_off, 0xffa30ca0) // 5/1
+// ALT: NSTUB(kbd_pwr_off, 0xffa30cbc) // 5/1
+// Best match: 55%
+NSTUB(kbd_pwr_on, 0xffa27648)
+// ALT: NSTUB(kbd_pwr_on, 0xffa27674) // 5/4
+// ALT: NSTUB(kbd_pwr_on, 0xffa27b74) // 5/4
+// ERROR: kbd_read_keys_r2 is not found!
+// Best match: 93%
+NSTUB(localtime, 0xff918fd8)
+NSTUB(lseek, 0xff91d2c4)
+// Best match: 53%
+NSTUB(malloc, 0xff9201c0)
+// ALT: NSTUB(malloc, 0xff9201c0) // 15/13
+NSTUB(memcmp, 0xff9183b8)
+// ALT: NSTUB(memcmp, 0xff924380) // 9/0
+NSTUB(memcpy, 0xff9183f4)
+NSTUB(memset, 0xff91846c)
+// Best match: 51%
+NSTUB(mkdir, 0xffa9a270)
+// ALT: NSTUB(mkdir, 0xffa9a344) // 16/15
+NSTUB(open, 0xff91d7c4)
+NSTUB(opendir, 0xffb526f4)
+NSTUB(qsort, 0xff917c18)
+NSTUB(rand, 0xff917c3c)
+// ALT: NSTUB(rand, 0xff917c3c) // 8/0
+NSTUB(read, 0xff91d1e0)
+NSTUB(readdir, 0xffb5268c)
+NSTUB(rename, 0xff91d7cc)
+// ALT: NSTUB(rename, 0xff91d7cc) // 26/0
+NSTUB(rewinddir, 0xffb526b4)
+NSTUB(srand, 0xff917c60)
+// ALT: NSTUB(srand, 0xff917c60) // 4/0
+NSTUB(stat, 0xffb52788)
+NSTUB(strcat, 0xff91848c)
+NSTUB(strchr, 0xff9184b8)
+NSTUB(strcmp, 0xff9184dc)
+NSTUB(strcpy, 0xff918670)
+NSTUB(strlen, 0xff9187d4)
+NSTUB(strncmp, 0xff918838)
+NSTUB(strncpy, 0xff91887c)
+// ALT: NSTUB(strncpy, 0xff91887c) // 24/0
+NSTUB(strpbrk, 0xff9188c4)
+NSTUB(strrchr, 0xff918900)
+// ALT: NSTUB(strrchr, 0xff918900) // 8/0
+NSTUB(strtol, 0xff918054)
+NSTUB(taskCreateHookAdd, 0xff922e20)
+NSTUB(taskDeleteHookAdd, 0xff922d5c)
+// Best match: 82%
+NSTUB(taskIdListGet, 0xff92a308)
+NSTUB(taskLock, 0xff92a9c4)
+NSTUB(taskName, 0xff92a200)
+NSTUB(taskResume, 0xff92a5e4)
+NSTUB(taskSuspend, 0xff92a410)
+NSTUB(taskUnlock, 0xff92aa6c)
+NSTUB(time, 0xff919d24)
+// ALT: NSTUB(time, 0xff919d24) // 25/0
+// Best match: 57%
+NSTUB(utime, 0xffb5281c)
+// ALT: NSTUB(utime, 0xffb5281c) // 15/11
+NSTUB(vsprintf, 0xff91bf28)
+NSTUB(write, 0xff91d250)
Index: /trunk/platform/ixus70_sd1000/sub/102a/stubs_entry_2.S
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/102a/stubs_entry_2.S	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/102a/stubs_entry_2.S	(revision 511)
@@ -0,0 +1,38 @@
+#include "stubs_asm.h"
+
+NHSTUB(Close,  0xFFA9A008)
+NHSTUB(DisplayImagePhysicalScreen, 0xFFA25068)
+NHSTUB(Mount_FileSystem, 0xFFA9932C)
+NHSTUB(Read,   0xFFA9A09C)
+NHSTUB(Remove, 0xFFA9A028)
+NHSTUB(Write,  0xFFA9A0A8)
+NHSTUB(free, 0xFF9201CC)
+NHSTUB(kbd_read_keys_r2, 0xFFA30724)
+
+NSTUB(GetCurrentAvValue, 0xFFAD9E94)
+
+NHSTUB(AllocateMemory, 0xFF818664)
+NHSTUB(FreeMemory, 0xFF818650) 
+NHSTUB(GetFocusLensSubjectDistance, 0xFFAD2FB4) 
+NHSTUB(TakeSemaphore, 0xFFB141D4)
+NHSTUB(kbd_pwr_off, 0xFFA30C58)
+NHSTUB(kbd_pwr_on, 0xFFA30C18)
+NHSTUB(SetPropertyCase, 0xFF81BB60)
+
+NHSTUB(SetZoomActuatorSpeedPercent, 0xFF9AD778) //null stub
+
+NHSTUB(GetDrive_ClusterSize, 0xFFA997F4)
+NHSTUB(GetDrive_TotalClusters, 0xFFA99830)
+NHSTUB(GetDrive_FreeClusters, 0xFFA9986C)
+
+NHSTUB(MakeAFScan, 0xFFB000D0) // _sub_FFB000D0__SsPrepareSeqBase.c__572
+NHSTUB(ExpCtrlTool_StartContiAE, 0xFF96553C) // SetFocusLensDefaultCondition_3
+NHSTUB(ExpCtrlTool_StopContiAE,  0xFF96556C) // SetFocusLensDefaultCondition_5
+NHSTUB(GetBatteryTemperature, 0xFFA344E4)
+NHSTUB(GetCCDTemperature, 0xFFA344D0)
+NHSTUB(GetOpticalTemperature, 0xFFA344BC)
+NHSTUB(PT_PlaySound, 0xFFB0B2EC)
+
+
+NHSTUB(EnterToCompensationEVF, 0xffafab60)
+NHSTUB(ExitFromCompensationEVF, 0xffafabe4)
Index: /trunk/platform/ixus70_sd1000/sub/102a/boot.c
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/102a/boot.c	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/102a/boot.c	(revision 511)
@@ -0,0 +1,165 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+const long new_sa = MEMISOSTART + MEMISOSIZE;
+
+/* Ours stuff */
+extern long wrs_kernel_bss_start;
+extern long wrs_kernel_bss_end;
+extern void createHook (void *pNewTcb);
+extern void deleteHook (void *pTcb);
+
+
+void boot();
+
+/* "relocated" functions */
+void __attribute__((naked,noinline)) h_usrInit();
+void __attribute__((naked,noinline)) h_usrKernelInit();
+void __attribute__((naked,noinline)) h_usrRoot();
+
+
+
+void boot()
+{
+    long *canon_data_src = (void*)0xFFB88020; // found on "start of data"
+    long *canon_data_dst = (void*)0x1900; 
+    long canon_data_len = 0xCA00; 
+    long *canon_bss_start = (void*)0xE300; // 0xCA00 + 0x1900 just after data
+    long canon_bss_len = 0xBEF70 - 0xE300; // found in "kernelInit"
+    long i;
+
+    asm volatile (
+	"MRC     p15, 0, R0,c1,c0\n"
+	"ORR     R0, R0, #0x1000\n"
+	"ORR     R0, R0, #4\n"
+	"ORR     R0, R0, #1\n"
+	"MCR     p15, 0, R0,c1,c0\n"
+    :::"r0");
+
+    for(i=0;i<canon_data_len/4;i++)
+	canon_data_dst[i]=canon_data_src[i];
+
+    for(i=0;i<canon_bss_len/4;i++)
+	canon_bss_start[i]=0;
+
+    asm volatile (
+	"MRC     p15, 0, R0,c1,c0\n"
+	"ORR     R0, R0, #0x1000\n"
+	"BIC     R0, R0, #4\n"
+	"ORR     R0, R0, #1\n"
+	"MCR     p15, 0, R0,c1,c0\n"
+    :::"r0");
+
+    h_usrInit();
+}
+
+
+void h_usrInit()
+{
+    asm volatile (
+	"STR     LR, [SP,#-4]!\n"
+	"BL      sub_FF811968\n"
+	"MOV     R0, #2\n"
+	"MOV     R1, R0\n"
+	"BL      sub_FF919D64\n" //unknown_libname_230
+	"BL      sub_FF90DE5C\n" //excVecInit
+	"BL      sub_FF8111C4\n"
+	"BL      sub_FF811728\n"
+	"LDR     LR, [SP],#4\n"
+	"B       h_usrKernelInit\n"
+    );
+}
+
+void  h_usrKernelInit()
+{
+    asm volatile (
+	"STMFD   SP!, {R4,LR}\n"
+	"SUB     SP, SP, #8\n"
+	"BL      sub_FF91A264\n" //classLibInit
+	"BL      sub_FF92A390\n" //taskLibInit
+	"LDR     R3, =0x59C0\n"
+	"LDR     R2, =0xBBFE0\n"
+	"LDR     R1, [R3]\n"
+	"LDR     R0, =0xBCC30\n"
+	"MOV     R3, #0x100\n"
+	"BL      sub_FF925F80\n" //qInit
+	"LDR     R3, =0x5980\n"
+	"LDR     R0, =0x5D20\n"
+	"LDR     R1, [R3]\n"
+	"BL      sub_FF925F80\n" //qInit
+	"LDR     R3, =0x5A3C\n"
+	"LDR     R0, =0xBCC04\n"
+	"LDR     R1, [R3]\n"
+	"BL      sub_FF925F80\n" //qInit
+	"BL      sub_FF92E74C\n" //workQInit
+	"BL      sub_FF8112AC\n"
+	"MOV     R4, #0\n"
+	"MOV     R3, R0\n"
+	"MOV     R12, #0x800\n"
+	"LDR     R0, =h_usrRoot\n" // R0, =sub_FF811A60 (h_usrRoot))
+	"MOV     R1, #0x4000\n"
+    );    
+//	"LDR     R2, =0xEEF70\n" // 0xBEF70 + 0x30000
+    asm volatile (
+        "LDR     R2, =new_sa\n"
+        "LDR     R2, [R2]\n"
+    );
+    asm volatile (
+	"STR     R12, [SP]\n"
+	"STR     R4, [SP,#4]\n"
+	"BL      sub_FF9275D0\n" //kernelInit
+	"ADD     SP, SP, #8\n"
+	"LDMFD   SP!, {R4,PC}\n"
+    );
+}
+
+static long drv_struct[16];
+ 
+static long dh_err()
+{
+    return -1;
+}
+
+static void drv_self_hide()
+{
+    long drvnum;
+    
+    drvnum = _iosDrvInstall(dh_err,dh_err,dh_err,dh_err,dh_err,dh_err,dh_err);
+    if (drvnum >= 0)
+	_iosDevAdd(drv_struct, "A/DISKBOOT.BIN", drvnum);
+}
+
+
+void  h_usrRoot()
+{
+    asm volatile (
+	"STMFD   SP!, {R4,R5,LR}\n"
+	"MOV     R5, R0\n"
+	"MOV     R4, R1\n"
+	"BL      sub_FF8119D0\n"
+	"MOV     R1, R4\n"
+	"MOV     R0, R5\n"
+	"BL      sub_FF91ED1C\n" //memInit
+	"MOV     R1, R4\n"
+	"MOV     R0, R5\n"
+	"BL      sub_FF91F794\n" //memPartLibInit
+//	"BL      sub_FF8117E8\n" //nullSub_1
+	"BL      sub_FF811704\n"
+	"BL      sub_FF811A0C\n"
+	"BL      sub_FF8119F0\n"
+	"BL      sub_FF811A38\n"
+	"BL      sub_FF8119C4\n"
+    );
+
+    _taskCreateHookAdd(createHook);
+    _taskDeleteHookAdd(deleteHook);
+
+    drv_self_hide();
+
+    asm volatile (
+	"LDMFD   SP!, {R4,R5,LR}\n"
+	"B       sub_FF81136C\n" //IsEmptyWriteCache_2
+    );
+}
+
Index: /trunk/platform/ixus70_sd1000/sub/102a/stubs_min.S
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/102a/stubs_min.S	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/102a/stubs_min.S	(revision 511)
@@ -0,0 +1,15 @@
+#include "stubs_asm.h"
+
+DEF(physw_status, 0x564B0) // find in "PhySw"
+DEF(physw_run, 0x87B4) // find in "PhySw"
+
+DEF(zoom_busy, 0x96804) // find in "ZoomLens"
+DEF(focus_busy, 0x95F50) // find in "FocusLens"
+DEF(playrec_mode,0xD0CC) // BL      unknown_libname_797 found in "taskcreate_SsStartupTask"
+DEF(FlashParamsTable,0xFFB3E4BC) // BL      sub_FFB3E678 found in "ParameterManager.c"
+DEF(canon_menu_active,0x3760) // found in "StartRecModeMenu"
+DEF(canon_shoot_menu_active,0x27C9) // (0x27CC - 0x4 + 0x1) found in "taskcreate_DSITask"
+DEF(recreview_hold, 0x25AC) // (0x25B0 - 0x4) found in "AR:Snd:0x%04x"
+DEF(zoom_status, 0x2680)
+DEF(movie_status, 0xBB558)
+DEF(some_flag_for_af_scan, 0xCDB4) // found in _SsPrepareSeq.c__444+0x58, CMP R2,#0 | LDREQ R3,=0xCDB4 | STREQ R2,[R3]
Index: /trunk/platform/ixus70_sd1000/sub/102a/makefile.inc
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/102a/makefile.inc	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/102a/makefile.inc	(revision 511)
@@ -0,0 +1,15 @@
+#0x314F
+PLATFORMID=12623
+
+PLATFORMOS=vxworks
+
+MEMBASEADDR=0x1900
+RESTARTSTART=0x50000
+MEMISOSTART=0xBEF70
+MEMISOSIZE=0x55000
+ROMBASEADDR=0xff810000
+
+TARGET_PRIMARY=$(topdir)platform/$(PLATFORM)/sub/$(PLATFORMSUB)/PRIMARY.BIN
+
+PLFLAGS=-DMEMBASEADDR=$(MEMBASEADDR) -DMEMISOSTART=$(MEMISOSTART) -DMEMISOSIZE=$(MEMISOSIZE)
+PLFLAGS+=-DRESTARTSTART=$(RESTARTSTART)
Index: /trunk/platform/ixus70_sd1000/sub/102a/stubs_asm.h
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/102a/stubs_asm.h	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/102a/stubs_asm.h	(revision 511)
@@ -0,0 +1,20 @@
+    .text
+
+#define DEF(n,a) \
+    .globl n; n = a
+
+#define NSTUB(name, addr)\
+    .globl _##name ;\
+    .weak _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define NHSTUB(name, addr)\
+    .globl _##name ;\
+    _##name: ;\
+	ldr  pc, = ## addr
+
+#define STUB(addr)\
+    .globl sub_ ## addr ;\
+    sub_ ## addr: ;\
+	ldr  pc, =0x ## addr
Index: /trunk/platform/ixus70_sd1000/sub/102a/lib.c
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/102a/lib.c	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/102a/lib.c	(revision 511)
@@ -0,0 +1,75 @@
+#include "platform.h"
+#include "keyboard.h"
+
+void *hook_raw_fptr()
+{
+    return (void*)0x53B98; // find on "taskcreate_ImageSensorTask" 
+}
+
+void *hook_raw_ret_addr()
+{
+    return (void*)0xFF9AB668; // BL      nullsub_100
+}
+
+char *hook_raw_image_addr()
+{
+    return (char*)0x10E706A0; //(0x10E70000 + 0x6A0) (find on "A/%08x.CRW")
+}
+
+long hook_raw_size()
+{
+    return 0x8CAE10; //7mpx (0x8C0000 + 0xAE00 + 0x10)(find on "A/%08x.CRW")
+}
+
+void *vid_get_viewport_live_fb()
+{
+//    return (void*)0; // 0x1065BA50 + 0x7E900 (find on "VRAM Address  : %p")
+    void **fb=(void **)0x6F8C;
+    unsigned char buff = *((unsigned char*)0x6F9C);
+    if (buff == 0) {
+        buff = 2;
+    }
+    else {
+        buff--;
+    }
+    return fb[buff];
+}
+
+void *vid_get_bitmap_fb()
+{
+    return (void*)0x10361000; //(0x10360000 + 0x1000) (find on "BmpDDev.c")
+}
+
+void *vid_get_viewport_fb()
+{
+    return (void*)(0x1065BA50); // 0x107F5B60 (find on "A/%08x.CRW") "0x1065BA50 (find on "VRAM Address  : %p")
+}
+
+void *vid_get_viewport_fb_d()
+{
+    return (void*)(*(int*)0x94408); // 0x94550 (find on "TerminateLowLevelConsole_3" )0x94408 (find on "ImagePlayer.c") 0x4D398 (find on "WBTblAdj.c")
+}
+
+long vid_get_bitmap_screen_width()
+{
+    return 360;
+}
+
+long vid_get_bitmap_screen_height()
+{
+    return 240;
+}
+
+long vid_get_viewport_height()
+{
+    return ((mode_get()&MODE_MASK) == MODE_PLAY)?240:230;
+}
+char *camera_jpeg_count_str()
+{
+    return (char*)0x12298;
+}
+
+long vid_get_bitmap_buffer_width() { return 360; }
+
+long vid_get_bitmap_buffer_height() { return 240; }
+
Index: /trunk/platform/ixus70_sd1000/sub/102a/movie_rec.c
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/102a/movie_rec.c	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/102a/movie_rec.c	(revision 511)
@@ -0,0 +1,358 @@
+#include "conf.h"
+
+int *video_quality = &conf.video_quality;
+int *video_mode    = &conf.video_mode;
+
+long def_table1[9]={0x2000,0x38D,0x788,0x5800,0x9C5,0x14B8,0x10000,0x1C6A,0x3C45};
+long def_table2[9]={0x1CCD,-0x2E1,-0x579,0x4F33,-0x7EB,-0xF0C,0xE666,-0x170A,-0x2BC6};
+
+long table1[9], table2[9];
+
+void change_video_tables(int a, int b){
+ int i;
+ for (i=0;i<9;i++) {table1[i]=(def_table1[i]*a)/b; table2[i]=(def_table2[i]*a)/b;}
+}
+
+long CompressionRateTable[]={0x60, 0x5D, 0x5A, 0x57, 0x54, 0x51, 0x4D, 0x48, 0x42, 0x3B, 0x32, 0x29, 0x22, 0x1D, 0x17, 0x14, 0x10, 0xE, 0xB, 9, 7, 6, 5, 4, 3, 2, 1};
+
+void __attribute__((naked,noinline)) movie_record_task(){
+ asm volatile(
+                 "STMFD   SP!, {R4,R5,LR}\n"
+                 "SUB     SP, SP, #4\n"
+                 "MOV     R5, SP\n"
+                 "MOV     R4, #0\n"
+ "loc_FFB81630:\n"
+                 "LDR     R3, =0xBB420\n"
+                 "MOV     R2, #0\n"
+                 "LDR     R0, [R3]\n"
+                 "MOV     R1, R5\n"
+                 "BL      sub_FFB1360C\n" //ReceiveMessageQueue
+                 "LDR     R3, =0xBB540\n"
+                 "LDR     R2, [R3]\n"
+                 "CMP     R2, #0\n"
+                 "BNE     loc_FFB816DC\n"
+                 "LDR     R1, [SP]\n"
+                 "LDR     R3, [R1]\n"
+                 "SUB     R3, R3, #2\n"
+                 "MOV     R0, R1\n"
+                 "CMP     R3, #9\n"
+                 "LDRLS   PC, [PC,R3,LSL#2]\n"
+                 "B       loc_FFB816E0\n"
+                 ".long loc_FFB816A0\n"
+                 ".long loc_FFB816B8\n"
+                 ".long loc_FFB816C0\n"
+                 ".long loc_FFB816C8\n"
+                 ".long loc_FFB816A8\n"
+                 ".long loc_FFB816D0\n"
+                 ".long loc_FFB816B0\n"
+                 ".long loc_FFB816E0\n"
+                 ".long loc_FFB816D8\n"
+                 ".long loc_FFB81698\n"
+ "loc_FFB81698:\n"
+                 "BL      sub_FFB8174C\n"
+                 "B       loc_FFB816DC\n"
+ "loc_FFB816A0:\n"
+                 "BL      unlock_optical_zoom\n" 
+                 "BL      sub_FFB81954\n"
+                 "B       loc_FFB816DC\n"
+ "loc_FFB816A8:\n"
+                 "BL      sub_FFB81D34_my\n"  //--------------->
+                 "B       loc_FFB816DC\n"
+ "loc_FFB816B0:\n"
+                 "BL      sub_FFB825C4\n"
+                 "B       loc_FFB816DC\n"
+ "loc_FFB816B8:\n"
+                 "BL      sub_FFB82078\n"
+                 "B       loc_FFB816DC\n"
+ "loc_FFB816C0:\n"
+                 "BL      sub_FFB82760\n"
+                 "B       loc_FFB816DC\n"
+ "loc_FFB816C8:\n"
+                 "BL      sub_FFB82940\n"
+                 "B       loc_FFB816DC\n"
+ "loc_FFB816D0:\n"
+                 "BL      sub_FFB8264C\n"
+                 "B       loc_FFB816DC\n"
+ "loc_FFB816D8:\n"
+                 "BL      sub_FFB820C8\n"
+ "loc_FFB816DC:\n"
+                 "LDR     R1, [SP]\n"
+ "loc_FFB816E0:\n"
+                 "LDR     R3, =0xBB424\n"
+                 "STR     R4, [R1]\n"
+                 "LDR     R0, [R3]\n"
+                 "MOV     R2, R4\n"
+                 "BL      sub_FFB13A24\n" //PostMessageQueue
+                 "B       loc_FFB81630\n"
+
+ );
+}
+
+void __attribute__((naked,noinline)) sub_FFB81D34_my(){
+ asm volatile(
+                 "STMFD   SP!, {R4-R11,LR}\n"
+                 "LDR     R7, =0xBB558\n"
+                 "SUB     SP, SP, #0x3C\n"
+                 "LDR     R3, [R7]\n"
+                 "MOV     R5, #0\n"
+                 "CMP     R3, #3\n"
+                 "MOV     R4, R0\n"
+                 "STR     R5, [SP,#0x34]\n"
+                 "STR     R5, [SP,#0x2C]\n"
+                 "MOV     R6, #1\n"
+                 "MOVEQ   R3, #4\n"
+                 "STREQ   R3, [R7]\n"
+                 "LDR     R3, =0xBB604\n"
+                 "MOV     LR, PC\n"
+                 "LDR     PC, [R3]\n"
+                 "LDR     R2, [R7]\n"
+                 "CMP     R2, #4\n"
+                 "BNE     loc_FFB81F90\n"
+                 "LDR     R3, =0xBB646\n"
+                 "LDRH    R2, [R3]\n"
+                 "CMP     R2, #1\n"
+                 "BNE     loc_FFB81DC4\n"
+                 "LDR     R2, =0xBB568\n"
+                 "LDR     R1, =0xBB648\n"
+                 "LDR     R0, [R2]\n"
+                 "LDRH    R3, [R1]\n"
+                 "MUL     R12, R3, R0\n"
+                 "LDR     R2, =0x10624DD3\n"
+                 "UMULL   R3, R1, R2, R12\n"
+                 "LDR     R3, =0xBB584\n"
+                 "MOV     R1, R1,LSR#6\n"
+                 "LDR     R0, [R3]\n"
+                 "BL      sub_FF914660\n" //__umodsi3
+                 "CMP     R0, #0\n"
+                 "MOVNE   R6, #0\n"
+                 "MOVEQ   R6, #1\n"
+ "loc_FFB81DC4:\n"
+                 "CMP     R6, #1\n"
+                 "BNE     loc_FFB81DE4\n"
+                 "ADD     R0, SP,#0x38\n"
+                 "ADD     R1, SP,#0x34\n"
+                 "ADD     R2, SP,#0x30\n"
+                 "ADD     R3, SP,#0x2C\n"
+                 "BL      sub_FFB834FC\n"
+                 "MOV     R5, R0\n"
+ "loc_FFB81DE4:\n"
+                 "CMP     R5, #0\n"
+                 "BNE     loc_FFB81E14\n"
+                 "LDR     R3, =0xBB548\n"
+                 "LDR     R2, [R3]\n"
+                 "CMP     R2, #1\n"
+                 "BNE     loc_FFB81E28\n"
+                 "LDR     R2, =0xBB584\n"
+                 "LDR     R1, =0xBB55C\n"
+                 "LDR     R0, [R2]\n"
+                 "LDR     R3, [R1]\n"
+                 "CMP     R0, R3\n"
+                 "BCC     loc_FFB81E28\n"
+ "loc_FFB81E14:\n"
+                 "MOV     R0, R5\n"
+                 "BL      sub_FFB81FF0\n"
+                 "BL      sub_FFB82584\n"
+                 "MOV     R3, #5\n"
+                 "B       loc_FFB81F8C\n"
+ "loc_FFB81E28:\n"
+                 "LDR     R9, [SP,#0x34]\n"
+                 "CMP     R9, #0\n"
+                 "BEQ     loc_FFB81F10\n"
+                 "LDR     R7, =0xBB5A0\n"
+                 "LDR     R12, =0xBB58C\n"
+                 "LDMIB   R4, {R0-R2}\n"
+                 "LDR     R10, [R4,#0x18]\n"
+                 "LDR     R6, [R7]\n"
+                 "LDR     R7, [R4,#0x14]\n"
+                 "LDR     R4, =0xBB54C\n"
+                 "LDR     R8, [R12]\n"
+                 "ADD     R5, SP, #0x2C\n"
+                 "LDMIA   R5, {R5,LR}\n"
+                 "MOV     R11, #1\n"
+                 "LDR     R3, [SP,#0x38]\n"
+                 "ADD     R12, SP, #0x28\n"
+                 "STR     R11, [R4]\n"
+                 "ADD     R4, SP, #0x24\n"
+                 "STMEA   SP, {R9,LR}\n"
+                 "STR     R5, [SP,#0x8]\n"
+                 "STR     R12, [SP,#0xC]\n"
+                 "STR     R8, [SP,#0x10]\n"
+                 "STR     R6, [SP,#0x14]\n"
+                 "STR     R7, [SP,#0x18]\n"
+                 "STR     R10, [SP,#0x1C]\n"
+                 "STR     R4, [SP,#0x20]\n"
+                 "BL      sub_FFB865A8\n"
+                 "LDR     R3, =0xBB418\n"
+                 "MOV     R1, #0x3E8\n"
+                 "LDR     R0, [R3]\n"
+                 "BL      sub_FFB141D4\n"
+                 "CMP     R0, #9\n"
+                 "BNE     loc_FFB81EBC\n"
+                 "BL      sub_FFB83D8C\n"
+                 "LDR     R3, =0xBB558\n"
+                 "LDR     R0, =0xFFB81D1C\n" //aJpegtimeout_5
+                 "B       loc_FFB81ED4\n"
+ "loc_FFB81EBC:\n"
+                 "LDR     R4, [SP,#0x24]\n"
+                 "CMP     R4, #0\n"
+                 "BEQ     loc_FFB81EE0\n"
+                 "BL      sub_FFB83D8C\n"
+                 "LDR     R3, =0xBB558\n"
+                 "LDR     R0, =0xFFB81D28\n" //aJpegicerror_5
+ "loc_FFB81ED4:\n"
+                 "STR     R11, [R3]\n"
+                 "BL      sub_FFB36F88\n"
+                 "B       loc_FFB81F90\n"
+ "loc_FFB81EE0:\n"
+                 "BL      sub_FFB86724\n"
+                 "LDR     R0, [SP,#0x38]\n"
+                 "LDR     R1, [SP,#0x28]\n"
+                 "BL      sub_FFB839E4\n"
+                 "LDR     R12, =0xBB580\n"
+                 "LDR     R3, [R12]\n"
+                 "ADD     R3, R3, #1\n"
+                 "LDR     R0, [SP,#0x28]\n"
+                 "LDR     R1, =0xBB5A0\n"
+                 "MOV     R2, R4\n"
+                 "STR     R3, [R12]\n"
+                 "BL      sub_FFAF2C44_my\n"   //----------------->
+ "loc_FFB81F10:\n"
+                 "LDR     R4, =0xBB584\n"
+                 "LDR     R2, =0xBB5AC\n"
+                 "LDR     R3, [R4]\n"
+                 "LDR     R1, [R2]\n"
+                 "LDR     R12, =0xBB5A8\n"
+                 "ADD     R3, R3, #1\n"
+                 "MUL     R0, R1, R3\n"
+                 "LDR     R1, [R12]\n"
+                 "STR     R3, [R4]\n"
+                 "BL      sub_FF9145C8\n" //__udivsi3
+                 "LDR     R6, =0xBB5A4\n"
+                 "MOV     R4, R0\n"
+                 "BL      sub_FFB83DC8\n"
+                 "LDR     R3, [R6]\n"
+                 "CMP     R3, R4\n"
+                 "BNE     loc_FFB81F64\n"
+                 "LDR     R5, =0xBB550\n"
+                 "LDR     R3, [R5]\n"
+                 "CMP     R3, #1\n"
+                 "BNE     loc_FFB81F84\n"
+                 "B       loc_FFB81F68\n"
+ "loc_FFB81F64:\n"
+                 "LDR     R5, =0xBB550\n"
+ "loc_FFB81F68:\n"
+                 "LDR     R2, =0xBB5E8\n"
+                 "MOV     R0, R4\n"
+                 "MOV     LR, PC\n"
+                 "LDR     PC, [R2]\n"
+                 "MOV     R3, #0\n"
+                 "STR     R3, [R5]\n"
+                 "STR     R4, [R6]\n"
+ "loc_FFB81F84:\n"
+                 "LDR     R7, =0xBB54C\n"
+                 "MOV     R3, #0\n"
+ "loc_FFB81F8C:\n"
+                 "STR     R3, [R7]\n"
+ "loc_FFB81F90:\n"
+                 "ADD     SP, SP, #0x3C\n"
+                 "LDMFD   SP!, {R4-R11,PC}\n"
+ );
+}
+
+void __attribute__((naked,noinline)) sub_FFAF2C44_my(){
+ asm volatile(
+                 "STMFD   SP!, {R4-R8,LR}\n"
+                 "LDR     R12, =0x96ED4\n"
+                 "LDR     R4, [R12]\n"
+                 "LDR     R3, =0x96EDC\n"
+                 "CMP     R4, #0\n"
+                 "MOV     R8, R1\n"
+                 "MOV     R7, R0\n"
+                 "LDR     R1, [R3]\n"
+                 "BEQ     loc_FFAF2C7C\n"
+                 "LDR     R2, =0x96EE0\n"
+                 "LDR     R3, [R2]\n"
+                 "CMP     R3, #1\n"
+                 "BNE     loc_FFAF2C90\n"
+                 "B       loc_FFAF2C80\n"
+ "loc_FFAF2C7C:\n"
+                 "LDR     R2, =0x96EE0\n"
+ "loc_FFAF2C80:\n"
+                 "MOV     R3, #0\n"
+                 "STR     R3, [R2]\n"
+                 "STR     R7, [R12]\n"
+                 "B       loc_FFAF2D48\n"
+ "loc_FFAF2C90:\n"
+                 "LDR     R2, =0x96ED8\n"
+                 "LDR     R3, [R2]\n"
+                 "LDR     R6, =table1\n"          // + 0xFFAF2B48
+                 "ADD     R3, R3, R3,LSL#1\n"
+                 "MOV     LR, R3,LSL#2\n"
+                 "LDR     R2, [R6,LR]\n"
+                 "LDR     R5, =table2\n"          // + 0xFFAF2B6C
+                 "RSB     R12, R2, R4\n"
+                 "LDR     R3, [R5,LR]\n"
+                 "CMP     R12, #0\n"
+                 "RSB     R0, R3, R4\n"
+                 "BLE     loc_FFAF2CF4\n"
+                 "ADD     R3, R6, #4\n"
+                 "LDR     R2, [R3,LR]\n"
+                 "CMP     R2, R12\n"
+                 "ADDGE   R1, R1, #1\n"
+                 "BGE     loc_FFAF2CE8\n"
+                 "ADD     R3, R6, #8\n"
+                 "LDR     R2, [R3,LR]\n"
+                 "CMP     R2, R12\n"
+                 "ADDGE   R1, R1, #2\n"
+                 "ADDLT   R1, R1, #3\n"
+ "loc_FFAF2CE8:\n"
+         //      "CMP     R1, #0x16\n"     // -
+         //      "MOVGE   R1, #0x16\n"     // -
+                 "CMP     R1, #0x1A\n"     // + 
+                 "MOVGE   R1, #0x1A\n"     // + 
+
+                 "B       loc_FFAF2D2C\n"
+ "loc_FFAF2CF4:\n"
+                 "CMP     R0, #0\n"
+                 "BGE     loc_FFAF2D2C\n"
+                 "ADD     R3, R5, #4\n"
+                 "LDR     R2, [R3,LR]\n"
+                 "CMP     R2, R0\n"
+                 "SUBLE   R1, R1, #1\n"
+                 "BLE     loc_FFAF2D24\n"
+                 "ADD     R3, R5, #8\n"
+                 "LDR     R2, [R3,LR]\n"
+                 "CMP     R2, R0\n"
+                 "SUBLE   R1, R1, #2\n"
+                 "SUBGT   R1, R1, #3\n"
+ "loc_FFAF2D24:\n"
+                 "CMP     R1, #0\n"
+                 "MOVLT   R1, #0\n"
+ "loc_FFAF2D2C:\n"
+                 "LDR     R0, =0x96EDC\n"
+                 "LDR     R3, [R0]\n"
+                 "CMP     R1, R3\n"
+                 "LDRNE   R2, =0x96EE0\n"
+                 "MOVNE   R3, #1\n"
+                 "STRNE   R1, [R0]\n"
+                 "STRNE   R3, [R2]\n"
+ "loc_FFAF2D48:\n"
+                 "LDR     R3, =0x96EDC\n"
+                 "LDR     R2, =CompressionRateTable\n"
+                 "LDR     R1, [R3]\n"
+                 "LDR     R0, =0x96ED4\n"
+                 "LDR     R3, [R2,R1,LSL#2]\n"
+
+                 "LDR     R1, =video_mode\n"      // +
+                 "LDR     R1, [R1]\n"             // +
+                 "LDR     R1, [R1]\n"             // +
+                 "CMP     R1, #1\n"               // +
+                 "LDREQ   R1, =video_quality\n"   // +     
+                 "LDREQ   R1, [R1]\n"             // +     
+                 "LDREQ   R3, [R1]\n"             // +     
+       
+                 "STR     R7, [R0]\n"
+                 "STR     R3, [R8]\n"
+                 "LDMFD   SP!, {R4-R8,PC}\n"
+ );
+}
Index: /trunk/platform/ixus70_sd1000/sub/102a/stubs_auto.S
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/102a/stubs_auto.S	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/102a/stubs_auto.S	(revision 511)
@@ -0,0 +1,93 @@
+/* THIS FILE IS GENERATED */
+/* DO NOT EDIT THIS FILE! */
+
+#include "stubs_asm.h"
+
+STUB(FF8111C4)
+STUB(FF8112AC)
+STUB(FF81136C)
+STUB(FF811704)
+STUB(FF811728)
+STUB(FF8117E8)
+STUB(FF811968)
+STUB(FF8119C4)
+STUB(FF8119D0)
+STUB(FF8119F0)
+STUB(FF811A0C)
+STUB(FF811A38)
+STUB(FF81BC98)
+STUB(FF81BE94)
+STUB(FF8261B8)
+STUB(FF90DE5C)
+STUB(FF9145C8)
+STUB(FF914660)
+STUB(FF919D64)
+STUB(FF91A264)
+STUB(FF91ED1C)
+STUB(FF91F794)
+STUB(FF925F80)
+STUB(FF9275D0)
+STUB(FF92A390)
+STUB(FF92E74C)
+STUB(FFA395F0)
+STUB(FFAF2C44)
+STUB(FFAFCF08)
+STUB(FFAFD480)
+STUB(FFAFEAD8)
+STUB(FFAFEBFC)
+STUB(FFAFECD8)
+STUB(FFAFEDB4)
+STUB(FFAFEE90)
+STUB(FFAFF3F8)
+STUB(FFAFF7B0)
+STUB(FFAFF7C0)
+STUB(FFAFF7D0)
+STUB(FFAFF7F8)
+STUB(FFAFF910)
+STUB(FFAFF980)
+STUB(FFAFFA18)
+STUB(FFAFFB6C)
+STUB(FFB009B4)
+STUB(FFB010E8)
+STUB(FFB012BC)
+STUB(FFB01350)
+STUB(FFB0144C)
+STUB(FFB0158C)
+STUB(FFB015E8)
+STUB(FFB016B8)
+STUB(FFB0188C)
+STUB(FFB01928)
+STUB(FFB019E8)
+STUB(FFB01CB8)
+STUB(FFB01D98)
+STUB(FFB01EB0)
+STUB(FFB01F14)
+STUB(FFB0222C)
+STUB(FFB0278C)
+STUB(FFB02920)
+STUB(FFB09228)
+STUB(FFB12EF4)
+STUB(FFB13090)
+STUB(FFB1360C)
+STUB(FFB13A24)
+STUB(FFB141D4)
+STUB(FFB14BD0)
+STUB(FFB2071C)
+STUB(FFB36F88)
+STUB(FFB8174C)
+STUB(FFB81954)
+STUB(FFB81D34)
+STUB(FFB81FF0)
+STUB(FFB82078)
+STUB(FFB820C8)
+STUB(FFB82584)
+STUB(FFB825C4)
+STUB(FFB8264C)
+STUB(FFB82760)
+STUB(FFB82940)
+STUB(FFB834FC)
+STUB(FFB839E4)
+STUB(FFB83D8C)
+STUB(FFB83DC8)
+STUB(FFB865A8)
+STUB(FFB86724)
Index: /trunk/platform/ixus70_sd1000/sub/102a/Makefile
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/102a/Makefile	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/102a/Makefile	(revision 511)
@@ -0,0 +1,6 @@
+topdir=../../../../
+
+OBJS=boot.o stubs_min.o stubs_auto.o stubs_entry.o lib.o stubs_entry_2.o capt_seq.o movie_rec.o
+STUBS_AUTO_DEPS=boot.c capt_seq.c movie_rec.c
+
+include $(topdir)/platform/makefile_sub.inc
Index: /trunk/platform/ixus70_sd1000/sub/Makefile
===================================================================
--- /trunk/platform/ixus70_sd1000/sub/Makefile	(revision 511)
+++ /trunk/platform/ixus70_sd1000/sub/Makefile	(revision 511)
@@ -0,0 +1,8 @@
+topdir=../../../
+include $(topdir)makefile.inc
+
+SUBDIRS=$(PLATFORMSUB)
+
+all: all-recursive
+
+clean: clean-recursive
Index: /trunk/platform/ixus70_sd1000/shooting.c
===================================================================
--- /trunk/platform/ixus70_sd1000/shooting.c	(revision 511)
+++ /trunk/platform/ixus70_sd1000/shooting.c	(revision 511)
@@ -0,0 +1,141 @@
+#define PARAM_FILE_COUNTER      0x37
+#define PARAM_EXPOSURE_COUNTER  0x02
+
+#include "platform.h"
+
+const ApertureSize aperture_sizes_table[] = {
+    {  9, 290, "2.8" }, // PROPCASE 23
+    { 10, 312, "3.2" },
+    { 11, 329, "3.2" },
+    { 12, 336, "3.5" },
+    { 13, 362, "3.5" },
+    { 14, 391, "4.0" },
+    { 15, 420, "4.5" },
+    { 16, 448, "4.9" },
+    { 17, 577, "8.0" },
+    { 18, 599, "9.0" },
+    { 19, 623, "10.0" },
+    { 20, 649, "10.0" },
+    { 21, 678, "11.0" },
+    { 22, 707, "13.0" },
+    { 23, 735, "14.0" },
+};
+
+const ShutterSpeed shutter_speeds_table[] = {
+    { -12, -384, "15", 15000000 }, // PROPCASE 262
+    { -11, -352, "13", 13000000 },
+    { -10, -320, "10", 10000000 },
+    {  -9, -288, "8",   8000000 },
+    {  -8, -256, "6",   6000000 },
+    {  -7, -224, "5",   5000000 },
+    {  -6, -192, "4",   4000000 },
+    {  -5, -160, "3.2", 3200000 },
+    {  -4, -128, "2.5", 2500000 },
+    {  -3,  -96, "2",   2000000 },
+    {  -2,  -64, "1.6", 1600000 },
+    {  -1,  -32, "1.3", 1300000 },
+    {   0,    0, "1",   1000000 },
+    {   1,   32, "0.8",  800000 },
+    {   2,   64, "0.6",  600000 },
+    {   3,   96, "0.5",  500000 },
+    {   4,  128, "0.4",  400000 },
+    {   5,  160, "0.3",  300000 },
+    {   6,  192, "1/4",  250000 },
+    {   7,  224, "1/5",  200000 },
+    {   8,  256, "1/6",  166667 },
+    {   9,  288, "1/8",  125000 },
+    {  10,  320, "1/10", 100000 },
+    {  11,  352, "1/13",  76923 },
+    {  12,  384, "1/15",  66667 },
+    {  13,  416, "1/20",  50000 },
+    {  14,  448, "1/25",  40000 },
+    {  15,  480, "1/30",  33333 },
+    {  16,  512, "1/40",  25000 },
+    {  17,  544, "1/50",  20000 },
+    {  18,  576, "1/60",  16667 },
+    {  19,  608, "1/80",  12500 },
+    {  20,  640, "1/100", 10000 },
+    {  21,  672, "1/125",  8000 },
+    {  22,  704, "1/160",  6250 },
+    {  23,  736, "1/200",  5000 },
+    {  24,  768, "1/250",  4000 },
+    {  25,  800, "1/320",  3125 },
+    {  26,  832, "1/400",  2500 },
+    {  27,  864, "1/500",  2000 },
+    {  28,  896, "1/640",  1563 },
+    {  29,  928, "1/800",  1250 },
+    {  30,  960, "1/1000", 1000 },
+    {  31,  992, "1/1250",  800 },
+    {  32, 1008, "1/1500",  667 },
+};
+
+const ISOTable iso_table[] = {
+    { -1,     1,    "HI", -1}, // PROPCASE 149
+    {  0,     0,  "Auto", -1},
+    {  1,    80,    "80", -1},
+    {  2,   100,   "100", -1},
+    {  3,   200,   "200", -1},
+    {  4,   400,   "400", -1},
+    {  5,   800,   "800", -1},
+    {  6,  1600,  "1600", -1},
+};          
+
+#include "../generic/shooting.c"
+
+long get_file_next_counter() {
+    return get_file_counter();
+}
+
+long get_target_file_num() {
+    long n;
+    
+    n = get_file_next_counter();
+    n = (n>>4)&0x3FFF;
+    return n;
+}
+
+long get_target_dir_num() {
+    long n;
+    
+    n = get_file_next_counter();
+    n = (n>>18)&0x3FF;
+    return n;
+}
+
+int circle_of_confusion = 5;
+
+char* shooting_get_tv_str()
+{
+    short int tvv;
+    long i;
+    _GetPropertyCase(PROPCASE_TV, &tvv, sizeof(tvv));
+    for (i=0;i<SS_SIZE;i++){
+   if (shutter_speeds_table[i].prop_id >= tvv)
+       return (char*)shutter_speeds_table[i].name;
+    }
+    return (void*)"?";
+}
+
+char* shooting_get_av_str()
+{
+    short int avv;
+    long i;
+    _GetPropertyCase(PROPCASE_AV, &avv, sizeof(avv));
+    for (i=0;i<AS_SIZE;i++){
+   if (aperture_sizes_table[i].prop_id == avv)
+       return (char*)aperture_sizes_table[i].name;
+    }
+    return (char*) "?";
+}
+
+char* shooting_get_iso_str()
+{
+    short int isov;
+    long i;
+    _GetPropertyCase(PROPCASE_ISO_MODE, &isov, sizeof(isov));
+    for (i=0;i<ISO_SIZE;i++){
+   if (iso_table[i].prop_id == isov)
+       return (char*)iso_table[i].name;
+    }
+    return (char*) "?";
+}
Index: /trunk/platform/ixus70_sd1000/Makefile
===================================================================
--- /trunk/platform/ixus70_sd1000/Makefile	(revision 511)
+++ /trunk/platform/ixus70_sd1000/Makefile	(revision 511)
@@ -0,0 +1,25 @@
+curdir=./
+topdir=../../
+
+include $(topdir)makefile.inc
+
+CFLAGS+=-DLOW_LEVEL
+
+SUBDIRS=sub
+
+all: all-recursive libplatform.a
+
+OBJS=main.o lib.o wrappers.o kbd.o shooting.o
+# stubs_init.o
+
+kbd.o: kbd.c ../generic/kbd.c
+lib.o: lib.c ../generic/lib.c
+main.o: main.c ../generic/main.c
+shooting.o: shooting.c ../generic/shooting.c
+wrappers.o: wrappers.c ../generic/wrappers.c
+
+libplatform.a: $(OBJS)
+
+clean: clean-recursive
+	rm -f $(OBJS) libplatform.a
+
Index: /trunk/platform/ixusW_sd430/notes.txt
===================================================================
--- /trunk/platform/ixusW_sd430/notes.txt	(revision 511)
+++ /trunk/platform/ixusW_sd430/notes.txt	(revision 511)
@@ -0,0 +1,7 @@
+****************************************
+
+Camera depending notes: 
+
+This cam should work with CHDK as is, no special notes existing.
+
+
Index: /trunk/platform/ixusW_sd430/sub/110a/Makefile
===================================================================
--- /trunk/platform/ixusW_sd430/sub/110a/Makefile	(revision 511)
+++ /trunk/platform/ixusW_sd430/sub/110a/Makefile	(revision 511)
@@ -0,0 +1,6 @@
+topdir=../../../../
+
+OBJS=boot.o stubs_min.o stubs_auto.o stubs_entry.o lib.o stubs_entry_2.o capt_seq.o movie_rec.o
+STUBS_AUTO_DEPS=boot.c capt_seq.c movie_rec.c
+
+include $(topdir)/platform/makefile_sub.inc
Index: /trunk/platform/ixusW_sd430/sub/Makefile
===================================================================
--- /trunk/platform/ixusW_sd430/sub/Makefile	(revision 511)
+++ /trunk/platform/ixusW_sd430/sub/Makefile	(revision 511)
@@ -0,0 +1,8 @@
+topdir=../../../
+include $(topdir)makefile.inc
+
+SUBDIRS=$(PLATFORMSUB)
+
+all: all-recursive
+
+clean: clean-recursive
Index: /trunk/platform/ixusW_sd430/Makefile
===================================================================
--- /trunk/platform/ixusW_sd430/Makefile	(revision 511)
+++ /trunk/platform/ixusW_sd430/Makefile	(revision 511)
@@ -0,0 +1,26 @@
+curdir=./
+topdir=../../
+
+include $(topdir)makefile.inc
+
+CFLAGS+=-DLOW_LEVEL
+
+SUBDIRS=sub
+
+all: all-recursive libplatform.a
+
+OBJS=main.o lib.o wrappers.o kbd.o shooting.o
+# stubs_init.o
+
+kbd.o: kbd.c ../generic/kbd.c
+lib.o: lib.c ../generic/lib.c
+main.o: main.c ../generic/main.c
+shooting.o: shooting.c ../generic/shooting.c
+wrappers.o: wrappers.c ../generic/wrappers.c
+
+libplatform.a: $(OBJS)
+
+clean: clean-recursive
+	rm -f $(OBJS) libplatform.a
+
+include $(topdir)bottom.inc
Index: /trunk/platform/makefile_sub.inc
===================================================================
--- /trunk/platform/makefile_sub.inc	(revision 511)
+++ /trunk/platform/makefile_sub.inc	(revision 511)
@@ -0,0 +1,69 @@
+# This file is included from */sub/*/Makefile
+#
+
+include $(topdir)makefile.inc
+
+CFLAGS+=-DLOW_LEVEL
+
+all: libplatformsub.a
+
+TARGET_PRIMARY = PRIMARY.BIN
+
+#OBJS= should be defined in */sub/*/Makefile
+
+libplatformsub.a: $(OBJS)
+
+clean:
+	rm -f $(OBJS) libplatformsub.a stubs_entry.S.err stubs_not_found_names.err
+
+distclean: clean
+	rm -f stubs_entry.S stubs_auto.S
+	rm -rf .dep
+
+
+stubs_auto.S: $(STUBS_AUTO_DEPS)
+	@echo $^ \-\> $@
+ifeq ($(OSTYPE),Windows)
+	cat $^ | \
+	    grep -E 'B[[:alpha:]]*[[:space:]]+sub_[0-9A-Fa-f]' | \
+	    sed 's/.*[[:space:]]sub_\\([0-9A-Fa-f]*\\).*/\\1/' | \
+	    $(SORT) | uniq | \
+	    awk 'BEGIN {print "/* THIS FILE IS GENERATED */\n/* DO NOT EDIT THIS FILE! */\n\n#include \"stubs_asm.h\"\n"} \
+	        {printf("STUB(%s)\n",$$1)}' > stubs_auto.S
+else	
+	cat $^ | \
+	    grep -E 'B[[:alpha:]]*[[:space:]]+sub_[0-9A-Fa-f]' | \
+	    sed 's/.*[[:space:]]sub_\([0-9A-Fa-f]*\).*/\1/' | \
+	    $(SORT) | uniq | \
+	    awk 'BEGIN {print "/* THIS FILE IS GENERATED */\n/* DO NOT EDIT THIS FILE! */\n\n#include \"stubs_asm.h\"\n"} \
+	        {printf("STUB(%s)\n",$$1)}' > stubs_auto.S
+endif
+
+stubs_entry.S: $(TARGET_PRIMARY) $(topdir)tools/signatures_$(PLATFORMOS).h $(topdir)tools/finsig$(EXE)
+	@echo \-\> $@
+	rm -f stubs_entry.S.err
+	if [ -s $(TARGET_PRIMARY) ] ; then \
+	  $(topdir)tools/finsig $(TARGET_PRIMARY) $(ROMBASEADDR) > stubs_entry.S ; \
+	else \
+	  echo CAUTION! \'stubs_entry.S\' is not uptated due to target firmware binary not found! ; \
+	  touch stubs_entry.S ; \
+	fi ; \
+	if [ "X`grep 'ERROR' stubs_entry.S`" != "X" ] ; then \
+	  grep "ERROR" stubs_entry.S | $(ESED) "s/\/\/ ERROR: ([^ ]+) is not found.*/\1/" | $(SORT) | uniq > stubs_nf.names ; \
+	  grep -E "NH?STUB" stubs_entry_2.S | $(ESED) "s/ *NH?STUB\( *([^ ,]+).*/\1/" | $(SORT) | uniq > stubs_mn.names ; \
+	  comm -23 stubs_nf.names stubs_mn.names > stubs_not_found_names.err ; \
+	  rm -f stubs_nf.names stubs_mn.names ; \
+	  if [ -s stubs_not_found_names.err ] ; then \
+	    echo ERROR! There are unresolved addresses in \'stubs_entry.S\' \($(PLATFORM)-$(PLATFORMSUB)\) for the following names: ; \
+	    cat stubs_not_found_names.err ; \
+	    echo Please, add them into \'stubs_entry_2.S\' manually! ; \
+	    mv stubs_entry.S stubs_entry.S.err ; \
+	    exit 1 ; \
+	  fi ; \
+	  rm -f stubs_not_found_names.err ; \
+	fi
+
+$(TARGET_PRIMARY):
+	touch $(TARGET_PRIMARY)
+
+include $(topdir)bottom.inc
Index: /trunk/platform/ixus850_sd800/kbd.c
===================================================================
--- /trunk/platform/ixus850_sd800/kbd.c	(revision 511)
+++ /trunk/platform/ixus850_sd800/kbd.c	(revision 511)
@@ -0,0 +1,473 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "conf.h"
+#include "core.h"
+#include "keyboard.h"
+
+typedef struct {
+	short grp;
+	long hackkey;
+	long canonkey;
+} KeyMap;
+
+
+static long kbd_new_state[3];
+static long kbd_prev_state[3];
+static long kbd_mod_state[3];
+static KeyMap keymap[];
+static long last_kbd_key = 0;
+static int usb_power=0;
+static int remote_key, remote_count;
+static int shoot_counter=0;
+#define DELAY_TIMEOUT 10000
+#define USB_MASK (0x40000) 
+#define USB_REG 2
+
+
+#define KEYS_MASK0 (0x00000000)
+#define KEYS_MASK1 (0xc0000000) // (0xc0800000)
+#define KEYS_MASK2 (0x0ffc)
+
+#define NEW_SS (0x2000)
+#define SD_READONLY_FLAG (0x20000)
+
+#ifndef MALLOCD_STACK
+static char kbd_stack[NEW_SS];
+#endif
+
+long __attribute__((naked)) wrap_kbd_p1_f() ;
+
+void wait_until_remote_button_is_released(void)
+{
+int count1;
+int count2;
+int tick,tick2,tick3;
+int nSW;
+int prev_usb_power,cur_usb_power;
+ // ------ add by Masuji SUTO (start) --------------
+    static int nMode;
+ // ------ add by Masuji SUTO (end)   --------------
+
+asm volatile ("STMFD SP!, {R0-R11,LR}\n"); // store R0-R11 and LR in stack
+
+debug_led(1);
+tick = get_tick_count();
+tick2 = tick;
+static long usb_physw[3];
+  if (conf.synch_enable && conf.ricoh_ca1_mode && conf.remote_enable && (!shooting_get_drive_mode()|| (shooting_get_drive_mode()==1) || ((shooting_get_drive_mode()==2) && state_shooting_progress != SHOOTING_PROGRESS_PROCESSING)))                                       
+// if (conf.synch_enable && conf.ricoh_ca1_mode && conf.remote_enable && (!shooting_get_drive_mode()|| ((shooting_get_drive_mode()==2) && state_shooting_progress != SHOOTING_PROGRESS_PROCESSING)))  // synch mode enable so wait for USB to disconnect
+  {
+// ------ add by Masuji SUTO (start) --------------
+        nMode=0;
+        usb_physw[2] = 0;                                             // makes sure USB bit is cleared.
+        _kbd_read_keys_r2(usb_physw);
+        if((usb_physw[2] & USB_MASK)==USB_MASK) nMode=1;
+// ------ add by Masuji SUTO (end)   --------------
+
+if(conf.ricoh_ca1_mode && conf.remote_enable)
+{
+	if(shooting_get_drive_mode()==1 && state_shooting_progress == SHOOTING_PROGRESS_PROCESSING){			//continuous-shooting mode
+		if(conf.bracket_type>2){
+			if(shoot_counter<2) shutter_int=3;
+			shoot_counter--;
+			}
+		else{
+			prev_usb_power=0;
+			nSW = 0;
+			do
+				{     
+				usb_physw[2] = 0;                                             // makes sure USB bit is cleared.
+				_kbd_read_keys_r2(usb_physw);
+				cur_usb_power = (usb_physw[2] & USB_MASK)==USB_MASK;
+				if(cur_usb_power){
+					if(!prev_usb_power){
+						tick2 = get_tick_count();
+						prev_usb_power=cur_usb_power;
+						}
+					else{
+						if((int)get_tick_count()-tick2>1000) {debug_led(0);}
+						}
+					}
+				else{
+					if(prev_usb_power){
+						tick3 = (int)get_tick_count()-tick2;
+						if(nSW==10) {
+							if(tick3>50) shutter_int=1;
+							nSW=20;
+							}
+						if(nSW==0 && tick3>0) {
+							if(tick3<50) {
+							nSW=10;
+							}
+						else{
+							if(tick3>1000) shutter_int=1;
+								nSW=20;
+							}
+						}
+						prev_usb_power=cur_usb_power;
+						}
+					}
+				if((int)get_tick_count()-tick >= DELAY_TIMEOUT) {nSW=20;shutter_int=2;}
+				}
+			 while(nSW<20);
+			 }
+		} 		//continuous-shooting mode 
+		else{		//nomal mode 
+			shoot_counter=0;
+			if(conf.bracket_type>2){
+				shoot_counter=(conf.bracket_type-2)*2;
+				}
+   do
+         {     
+            usb_physw[2] = 0;                                             // makes sure USB bit is cleared.
+           _kbd_read_keys_r2(usb_physw);
+           }
+//   while(((usb_physw[2] & USB_MASK)==USB_MASK) && ((int)get_tick_count()-tick < DELAY_TIMEOUT));
+// ------ modif by Masuji SUTO (start) --------------
+        while(((((usb_physw[2] & USB_MASK)!=USB_MASK) && (nMode==0)) || (((usb_physw[2] & USB_MASK)==USB_MASK) && (nMode==1))) && ((int)get_tick_count()-tick < DELAY_TIMEOUT));
+// ------ modif by Masuji SUTO (end)   --------------
+	} 
+ }
+
+else
+   {
+
+      do
+          {
+            usb_physw[2] = 0;                                             // makes sure USB bit is cleared.
+           _kbd_read_keys_r2(usb_physw);
+             
+           }
+        while((usb_physw[2]&USB_MASK) &&  ((int)get_tick_count()-tick < DELAY_TIMEOUT));
+    }
+
+  }
+
+if (conf.synch_delay_enable && conf.synch_delay_value>0)                                // if delay is switched on and greater than 0
+  {
+    for (count1=0;count1<conf.synch_delay_value+(conf.synch_delay_coarse_value*1000);count1++) // wait delay_value * 0.1ms
+    {
+      for (count2=0;count2<1400;count2++)            // delay approx. 0.1ms
+        {
+        }
+     }
+  }
+
+debug_led(0);
+asm volatile ("LDMFD SP!, {R0-R11,LR}\n"); // restore R0-R11 and LR from stack
+}
+
+static void __attribute__((noinline)) mykbd_task_proceed()
+{
+    while (physw_run){
+	_SleepTask(10);
+
+	if (wrap_kbd_p1_f() == 1){ // autorepeat ?
+	    _kbd_p2_f();
+	}
+    }
+}
+
+void __attribute__((naked,noinline)) mykbd_task(long ua, long ub, long uc, long ud, long ue, long uf)
+{
+    /* WARNING
+     * Stack pointer manipulation performed here!
+     * This means (but not limited to):
+     *	function arguments destroyed;
+     *	function CAN NOT return properly;
+     *	MUST NOT call or use stack variables before stack
+     *	is setup properly;
+     *
+     */
+
+    register int i;
+    register long *newstack;
+
+#ifndef MALLOCD_STACK
+    newstack = (void*)kbd_stack;
+#else
+    newstack = malloc(NEW_SS);
+#endif
+
+    for (i=0;i<NEW_SS/4;i++)
+	newstack[i]=0xdededede;
+
+    asm volatile (
+	"MOV	SP, %0"
+	:: "r"(((char*)newstack)+NEW_SS)
+	: "memory"
+    );
+
+    mykbd_task_proceed();
+
+    /* function can be modified to restore SP here...
+     */
+
+    _ExitTask();
+}
+
+
+long __attribute__((naked,noinline)) wrap_kbd_p1_f()
+{
+
+    asm volatile(
+                "STMFD   SP!, {R4-R7,LR}\n"
+                "SUB     SP, SP, #0xC\n"
+                "BL      my_kbd_read_keys\n"
+		"B	 _kbd_p1_f_cont\n"
+    );
+    return 0; // shut up the compiler
+}
+
+
+void my_kbd_read_keys()
+{
+    kbd_prev_state[0] = kbd_new_state[0];
+    kbd_prev_state[1] = kbd_new_state[1];
+    kbd_prev_state[2] = kbd_new_state[2];
+    _kbd_pwr_on();
+    kbd_fetch_data(kbd_new_state);
+
+    if (kbd_process() == 0){
+	// leave it alone...
+	physw_status[0] = kbd_new_state[0];
+	physw_status[1] = kbd_new_state[1];
+	physw_status[2] = kbd_new_state[2];
+	//physw_status[1] |= alt_mode_key_mask;
+
+    } else {
+      // override keys
+        physw_status[0] = (kbd_new_state[0] & (~KEYS_MASK0)) |
+              (kbd_mod_state[0] & KEYS_MASK0);
+
+        physw_status[1] = (kbd_new_state[1] & (~KEYS_MASK1)) |
+              (kbd_mod_state[1] & KEYS_MASK1);
+
+        physw_status[2] = (kbd_new_state[2] & (~KEYS_MASK2)) |
+              (kbd_mod_state[2] & KEYS_MASK2);
+    }
+
+
+
+    _kbd_read_keys_r2(physw_status);
+
+		remote_key = (physw_status[2] & USB_MASK)==USB_MASK;
+		if (remote_key) 
+			remote_count += 1;
+		else if (remote_count) {
+			usb_power = remote_count;
+			remote_count = 0;
+		}
+	if (conf.remote_enable) {
+		physw_status[2] = physw_status[2] & ~(SD_READONLY_FLAG | USB_MASK);
+	}
+	else
+		physw_status[2] = physw_status[2] & ~SD_READONLY_FLAG;
+
+
+    _kbd_pwr_off();
+
+}
+
+int get_usb_power(int edge)
+{
+	int x;
+
+	if (edge) return remote_key;
+	x = usb_power;
+	usb_power = 0;
+	return x;
+}
+
+/* void kbd_set_alt_mode_key_mask(long key)
+{
+    int i;
+    for (i=0; keymap[i].hackkey; ++i) {
+	if (keymap[i].hackkey == key) {
+	    alt_mode_key_mask = keymap[i].canonkey;
+	    return;
+	}
+    }
+} */
+
+void kbd_key_press(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    kbd_mod_state[keymap[i].grp] &= ~keymap[i].canonkey;
+	    return;
+	}
+    }
+}
+
+void kbd_key_release(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    kbd_mod_state[keymap[i].grp] |= keymap[i].canonkey;
+	    return;
+	}
+    }
+}
+
+void kbd_key_release_all()
+{
+  kbd_mod_state[0] |= KEYS_MASK0;
+  kbd_mod_state[1] |= KEYS_MASK1;
+  kbd_mod_state[2] |= KEYS_MASK2;
+}
+
+long kbd_is_key_pressed(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    return ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0) ? 1:0;
+	}
+    }
+    return 0;
+}
+
+long kbd_is_key_clicked(long key)
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (keymap[i].hackkey == key){
+	    return ((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
+		    ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0);
+	}
+    }
+    return 0;
+}
+
+long kbd_get_pressed_key()
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0){
+	    return keymap[i].hackkey;
+	}
+    }
+    return 0;
+}
+
+long kbd_get_clicked_key()
+{
+    int i;
+    for (i=0;keymap[i].hackkey;i++){
+	if (((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
+	    ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0)){
+	    return keymap[i].hackkey;
+	}
+    }
+    return 0;
+}
+
+void kbd_reset_autoclicked_key() {
+    last_kbd_key = 0;
+}
+
+long kbd_get_autoclicked_key() {
+    static long last_kbd_time = 0, press_count = 0;
+    register long key, t;
+
+    key=kbd_get_clicked_key();
+    if (key) {
+        last_kbd_key = key;
+        press_count = 0;
+        last_kbd_time = get_tick_count();
+        return key;
+    } else {
+        if (last_kbd_key && kbd_is_key_pressed(last_kbd_key)) {
+            t = get_tick_count();
+            if (t-last_kbd_time>((press_count)?175:500)) {
+                ++press_count;
+                last_kbd_time = t;
+                return last_kbd_key;
+            } else {
+                return 0;
+            }
+        } else {
+            last_kbd_key = 0;
+            return 0;
+        }
+    }
+	
+	
+}
+
+long kbd_use_zoom_as_mf() { 
+    static long v;
+    static long zoom_key_pressed = 0;
+
+    if (kbd_is_key_pressed(KEY_ZOOM_IN) && (mode_get()&MODE_MASK) == MODE_REC) {
+        get_property_case(PROPCASE_FOCUS_MODE, &v, 4);
+        if (v) {
+            kbd_key_release_all();
+            kbd_key_press(KEY_RIGHT);
+            zoom_key_pressed = KEY_ZOOM_IN;
+            return 1;
+        }
+    } else {
+        if (zoom_key_pressed==KEY_ZOOM_IN) {
+            kbd_key_release(KEY_RIGHT);
+            zoom_key_pressed = 0;
+            return 1;
+        }
+    }
+    if (kbd_is_key_pressed(KEY_ZOOM_OUT) && (mode_get()&MODE_MASK) == MODE_REC) {
+        get_property_case(PROPCASE_FOCUS_MODE, &v, 4);
+        if (v) {
+            kbd_key_release_all();
+            kbd_key_press(KEY_LEFT);
+            zoom_key_pressed = KEY_ZOOM_OUT;
+            return 1;
+        }
+    } else {
+        if (zoom_key_pressed==KEY_ZOOM_OUT) {
+            kbd_key_release(KEY_LEFT);
+            zoom_key_pressed = 0;
+            return 1;
+        }
+    }
+    return 0;
+}
+
+
+
+static KeyMap keymap[] = {
+    /* tiny bug: key order matters. see kbd_get_pressed_key()
+     * for example
+     */
+	{2, KEY_UP	, 0x00000010 },
+	{2, KEY_DOWN	, 0x00000040 },
+	{2, KEY_LEFT	, 0x00000080 },
+	{2, KEY_RIGHT	, 0x00000020 },
+	{2, KEY_SET	, 0x00000100 },
+	{1, KEY_SHOOT_FULL, 0xC0000000 }, // note 3 here!
+	{1, KEY_SHOOT_HALF, 0x40000000 },
+	{2, KEY_ZOOM_IN	, 0x00000004 },
+	{2, KEY_ZOOM_OUT, 0x00000008 },
+	{2, KEY_MENU	, 0x00000200 },
+	{2, KEY_DISPLAY	, 0x00000400 },
+	{2, KEY_PRINT	, 0x00000800 },
+      //  {2, KEY_DUMMY	, 0x00000800 },
+	{ 0, 0 }
+};
+
+
+
+
+ void kbd_fetch_data(long *dst)
+{
+    volatile long *mmio0 = (void*)0xc0220200;
+    volatile long *mmio1 = (void*)0xc0220204;
+    volatile long *mmio2 = (void*)0xc0220208;
+
+    dst[0] = *mmio0;
+    dst[1] = *mmio1;
+    dst[2] = *mmio2 & 0xffff;
+}
+
Index: /trunk/platform/ixus850_sd800/wrappers.c
===================================================================
--- /trunk/platform/ixus850_sd800/wrappers.c	(revision 511)
+++ /trunk/platform/ixus850_sd800/wrappers.c	(revision 511)
@@ -0,0 +1,16 @@
+#include "../generic/wrappers.c"
+
+long lens_get_focus_pos()
+{
+    return _GetFocusLensSubjectDistance();
+}
+
+long lens_get_focus_pos_from_lense()
+{
+    return _GetFocusLensSubjectDistanceFromLens();
+}
+
+long lens_get_target_distance()
+{
+    return _GetCurrentTargetDistance();
+}
Index: /trunk/platform/ixus850_sd800/main.c
===================================================================
--- /trunk/platform/ixus850_sd800/main.c	(revision 511)
+++ /trunk/platform/ixus850_sd800/main.c	(revision 511)
@@ -0,0 +1,76 @@
+#include "../generic/main.c"
+
+long get_vbatt_min()
+{
+    return 3500;
+}
+
+long get_vbatt_max()
+{
+    return 4100;
+}
+
+static const int fl_tbl[] = {4600, 6140, 7560, 9110, 10830, 12670, 14690, 17300};
+#define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0]))
+#define CF_EFL 60869
+
+const int zoom_points = NUM_FL;
+
+int get_effective_focal_length(int zp) {
+    return (CF_EFL*get_focal_length(zp))/10000;
+}
+
+int get_focal_length(int zp) {
+    if (zp<0) return fl_tbl[0];
+    else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1];
+    else return fl_tbl[zp];
+}
+
+int get_zoom_x(int zp) {
+    if (zp<1) return 10;
+    else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0];
+    else return fl_tbl[zp]*10/fl_tbl[0];
+}
+
+static struct {
+	int hackmode;
+	int canonmode;
+} modemap[] = {
+    { MODE_AUTO,               32768 }, // PROPCACE 49
+//    { MODE_M,                  32772 },
+    { MODE_P,                  32772 },
+    { MODE_DIGITAL_MACRO,      33288 },
+    { MODE_PORTRAIT,           32781 },
+    { MODE_NIGHT_SNAPSHOT,     32779 },
+    { MODE_COLOR_ACCENT,       33306 }, //  { MODE_SCN_COLOR_ACCENT,   33306 },
+    { MODE_MY_COLORS,          33307 },
+    { MODE_SCN_KIDS_PETS,      16400 }, //  { MODE_SCN_CHILD,          16400 },
+    { MODE_SCN_INDOOR,         16401 }, //  { MODE_SCN_PARTY,          16401 },
+    { MODE_SCN_FOLIAGE,        16402 }, //  { MODE_SCN_GRASS,          16402 },
+    { MODE_SCN_SNOW,           16403 },
+    { MODE_SCN_BEACH,          16404 },
+    { MODE_SCN_FIREWORK,       16405 },
+    { MODE_SCN_AQUARIUM,       16407 },
+    { MODE_SCN_WATER,          16406 },
+    { MODE_VIDEO_STD,          2597  },
+    { MODE_VIDEO_SPEED,        2598  },
+    { MODE_VIDEO_COMPACT,      2599  },
+    { MODE_VIDEO_COLOR_ACCENT, 2595  },
+    { MODE_VIDEO_MY_COLORS,    2596  },
+    { MODE_VIDEO_TIME_LAPSE,   2601  },
+    { MODE_STITCH,             33290 },
+};
+#define MODESCNT (sizeof(modemap)/sizeof(modemap[0]))
+
+int mode_get() {
+    int mode, i, t=0xFF;
+
+    mode  = (physw_status[2] & 0x4000)?MODE_REC:MODE_PLAY;    
+    _GetPropertyCase(PROPCASE_SHOOTING_MODE, &t, 4);
+    for (i=0; i<MODESCNT; ++i) {
+	if (modemap[i].canonmode == t) {
+	    return (mode | (modemap[i].hackmode & MODE_SHOOTING_MASK));
+	}
+    }
+    return (mode);
+}
Index: /trunk/platform/ixus850_sd800/notes.txt
===================================================================
--- /trunk/platform/ixus850_sd800/notes.txt	(revision 511)
+++ /trunk/platform/ixus850_sd800/notes.txt	(revision 511)
@@ -0,0 +1,11 @@
+****************************************
+
+Camera depending notes: 
+
+- ixus850_sd800 uses Propset 1 of Properties (see http://tinyurl.com/6zbv9b)
+- ixus850_sd800 does NOT have a real IRIS Diaphragm, it only has an ND Filter! 
+Mind this.
+- CHDK for firmware 1.00d is the SAME for 1.00e
+
+
+
Index: /trunk/platform/ixus850_sd800/lib.c
===================================================================
--- /trunk/platform/ixus850_sd800/lib.c	(revision 511)
+++ /trunk/platform/ixus850_sd800/lib.c	(revision 511)
@@ -0,0 +1,54 @@
+#include "platform.h"
+
+//define LED_AF    0xc02200C0 // found in "taskcreate_LEDCon"
+//define LED_BLUE  0xc02200C4
+//define LED_RED   0xc02200C8
+//define LED_GRN   0xc02200CC
+//define LED_YLW   0xc02200D0
+//define LED_PWR   0xc02200D4
+
+void shutdown()
+{
+    volatile long *p = (void*)0xc02200a0;
+        
+    asm(
+         "MRS     R1, CPSR\n"
+         "AND     R0, R1, #0x80\n"
+         "ORR     R1, R1, #0x80\n"
+         "MSR     CPSR_cf, R1\n"
+         :::"r1","r0");
+        
+    *p = 0x44;
+
+    while(1);
+}
+
+#define LED_PR 0xC02200C4
+
+void debug_led(int state)
+{
+    volatile long *p=(void*)LED_PR;
+    if (state)
+	p[0]=0x46;
+    else
+	p[0]=0x44;
+}
+
+// verified that at 0xFF9B0860 there are 110 entries
+int get_flash_params_count(void){
+ return 110;
+}
+
+#define LED_BASE 0xC02200C0
+
+void ubasic_set_led(int led, int state, int bright)
+{
+  int leds[] = {12,16,4,8,4,0,4};
+  if(led < 4 || led > 10 || led == 6) return;
+  volatile long *p=(void*)LED_BASE + leds[led-4];
+    if (state)
+	p[0]=0x46;
+    else
+	p[0]=0x44;
+}
+
Index: /trunk/platform/ixus850_sd800/sub/100e/capt_seq.c
===================================================================
--- /trunk/platform/ixus850_sd800/sub/100e/capt_seq.c	(revision 511)
+++ /trunk/platform/ixus850_sd800/sub/100e/capt_seq.c	(revision 511)
@@ -0,0 +1,300 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+#define RAWDATA_AVAILABLE (1)
+#define RAWDATA_SAVED (2)
+
+#define NR_ON (2)
+#define NR_OFF (1)
+
+static long raw_save_stage;
+
+void capt_seq_hook_raw_here()
+{
+    raw_save_stage = RAWDATA_AVAILABLE;
+    core_rawdata_available();
+    while (raw_save_stage != RAWDATA_SAVED){
+	_SleepTask(10);
+    }
+}
+
+void hook_raw_save_complete()
+{
+    raw_save_stage = RAWDATA_SAVED;
+}
+
+
+void capt_seq_hook_set_nr()
+{
+    long *nrflag = (long*)0x6ACC;
+
+    switch (core_get_noise_reduction_value()){
+    case NOISE_REDUCTION_AUTO_CANON:
+	// leave it alone
+	break;
+    case NOISE_REDUCTION_OFF:
+	*nrflag = NR_OFF;
+	break;
+    case NOISE_REDUCTION_ON:
+	*nrflag = NR_ON;
+	break;
+    };
+}
+
+void __attribute__((naked,noinline)) sub_FF99BA84_my(long p)
+{
+    asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                "MOV     R4, R0\n"
+                "SUB     SP, SP, #0xC\n"
+                "BL      sub_FF99C48C\n"
+//                "MOVL    R1, 0xFFFFFFFF\n"
+				"MVN     R1, #0\n"
+                "BL      sub_FF820FC8\n" // ClearEventFlag
+                "MOV     R0, #0x120\n" // MOV R0, #0x122 --> MOV #0x120 + ADD #0x2
+                "ADD     R0, R0, #0x2\n"
+                "ADD     R1, SP, #4\n"
+                "MOV     R2, #4\n"
+                "BL      sub_FF825A14\n" // GetPropertyCase
+                "TST     R0, #1\n"
+                "BEQ     loc_FF99BAC4\n"
+                "MOV     R1, #0x1D0\n"
+                "LDR     R0, =0xFF99B900\n" // aCaptureseq_c
+                "BL      sub_FF813E84\n" // DebugAssert
+ "loc_FF99BAC4:\n"
+                "LDR     R3, =0xB7CA0\n"
+                "LDR     R2, =0xB7D60\n"
+                "LDR     R0, [R3,#0x84]\n"
+                "LDRSH   R1, [R2,#0xE]\n"
+                "BL      sub_FF8B0144\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF99B884\n"
+                "BL      wait_until_remote_button_is_released\n"
+				"BL      capt_seq_hook_set_nr\n" // +
+                "LDR     R3, =0x6AD0\n"
+                "LDR     R0, [R3]\n"
+
+                "B       sub_FF99BAE8\n"  // ---> jump to end of function in ROM
+    );
+}
+
+void __attribute__((naked,noinline)) sub_FF998960_my(long p)
+{
+    asm volatile (
+                "STMFD   SP!, {R4,R5,LR}\n"
+                "LDR     R3, =0xB7CA0\n"
+                "LDR     R4, [R0,#0xC]\n"
+                "LDR     R1, [R3,#0x28]\n"
+                "LDR     R2, [R4,#8]\n"
+                "CMP     R1, #0\n"
+                "ORR     R2, R2, #1\n"
+                "STR     R2, [R4,#8]\n"
+                "BNE     loc_FF9989B4\n"
+                "MOV     R0, #0xC\n"
+                "BL      sub_FF9A2710\n"
+                "TST     R0, #1\n"
+                "BEQ     loc_FF9989B4\n"
+                "LDR     R3, [R4,#8]\n"
+                "MOV     R0, #1\n"
+                "ORR     R3, R3, #0x40000000\n"
+                "STR     R3, [R4,#8]\n"
+ "loc_FF9989A4:\n"
+                "MOV     R2, R4\n"
+                "MOV     R1, #1\n"
+                "LDMFD   SP!, {R4,R5,LR}\n"
+                "B       sub_FF9971EC\n"
+ "loc_FF9989B4:\n"
+                "LDR     R5, =0xB7CA0\n"
+                "LDR     R3, [R5,#0x28]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FF9989CC\n"
+                "MOV     R0, #2\n"
+                "BL      sub_FFB0628C\n"
+ "loc_FF9989CC:\n"
+                "BL      sub_FF999480\n" // Set_CMD25Write_26
+                "LDR     R3, [R5,#0x28]\n"
+                "CMP     R3, #0\n"
+                "BNE     loc_FF998A10\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF99A608\n"
+                "TST     R0, #1\n"
+                "BNE     loc_FF9989A4\n"
+                "BL      sub_FF9DA8C8\n"
+                "BL      sub_FF825C10\n"
+                "STR     R0, [R4,#0x14]\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF99B96C\n"
+                "BL      sub_FF99C318\n"
+                "MOV     R0, R4\n"
+                "BL      sub_FF99BA84_my\n"  //---------->
+                "BL      capt_seq_hook_raw_here\n"  // +
+                "B       loc_FF998A24\n"
+ "loc_FF998A10:\n"
+                "LDR     R3, =0x6AB0\n"
+                "LDR     R2, [R3]\n"
+                "CMP     R2, #0\n"
+                "MOVNE   R0, #0x1D\n"
+                "MOVEQ   R0, #0\n"
+ "loc_FF998A24:\n"
+                "MOV     R1, #1\n"
+                "MOV     R2, R4\n"
+                "BL      sub_FF9971EC\n"
+                "BL      sub_FF99BE04\n"
+                "CMP     R0, #0\n"
+                "LDRNE   R3, [R4,#8]\n"
+                "ORRNE   R3, R3, #0x2000\n"
+                "STRNE   R3, [R4,#8]\n"
+                "LDMFD   SP!, {R4,R5,PC}\n"
+    );
+}
+
+void __attribute__((naked,noinline)) capt_seq_task()
+{
+	asm volatile (
+                "STMFD   SP!, {R4,LR}\n"
+                "SUB     SP, SP, #4\n"
+                "MOV     R4, SP\n"
+                "B       loc_FF998FA8\n"
+ "loc_FF998E2C:\n"
+                "LDR     R2, [SP]\n"
+                "LDR     R3, [R2]\n"
+                "MOV     R0, R2\n"
+                "CMP     R3, #0x15\n"
+                "LDRLS   PC, [PC,R3,LSL#2]\n"
+                "B       loc_FF998F7C\n"
+                ".long loc_FF998E9C\n"
+                ".long loc_FF998EBC\n"
+                ".long loc_FF998ED0\n"
+                ".long loc_FF998EE4\n"
+                ".long loc_FF998EDC\n"
+                ".long loc_FF998EEC\n"
+                ".long loc_FF998EF4\n"
+                ".long loc_FF998F00\n"
+                ".long loc_FF998F08\n"
+                ".long loc_FF998F14\n"
+                ".long loc_FF998F1C\n"
+                ".long loc_FF998F24\n"
+                ".long loc_FF998F2C\n"
+                ".long loc_FF998F34\n"
+                ".long loc_FF998F3C\n"
+                ".long loc_FF998F48\n"
+                ".long loc_FF998F50\n"
+                ".long loc_FF998F58\n"
+                ".long loc_FF998F60\n"
+                ".long loc_FF998F6C\n"
+                ".long loc_FF998F74\n"
+                ".long loc_FF998F90\n"
+ "loc_FF998E9C:\n"
+				"BL      sub_FF9994A8\n" // ; jumptable FF998E3C case 0
+				"BL      shooting_expo_param_override\n"   // +
+				"BL      sub_FF996C88\n"
+				"LDR     R3, =0xB7CA0\n"
+				"LDR     R2, [R3,#0x28]\n"
+                "CMP     R2, #0\n"
+				"BEQ     loc_FF998F8C\n"
+				"BL      sub_FF998A50\n"
+				"B       loc_FF998F8C\n"
+ "loc_FF998EBC:\n"
+                                        
+				"BL      sub_FF998960_my\n" //----------> ; jumptable FF998E3C case 1
+
+ "loc_FF998EC0:\n"
+				"LDR     R2, =0xB7CA0\n"
+                "MOV     R3, #0\n"
+				"STR     R3, [R2,#0x28]\n"
+				"B       loc_FF998F8C\n"
+ "loc_FF998ED0:\n"
+				"MOV     R0, #1\n"       // ; jumptable FF998E3C case 2
+				"BL      sub_FF9996E8\n"
+				"B       loc_FF998F8C\n"
+ "loc_FF998EDC:\n"
+				"BL      sub_FF9990A0\n" //; jumptable FF998E3C case 4
+				"B       loc_FF998EC0\n"
+ "loc_FF998EE4:\n"
+				"BL      sub_FF999460\n" // BackLightDrv_LcdBackLightOff_4 ; jumptable FF998E3C case 3
+				"B       loc_FF998EC0\n"
+ "loc_FF998EEC:\n"
+				"BL      sub_FF999470\n" // ; jumptable FF998E3C case 5
+				"B       loc_FF998F8C\n"
+ "loc_FF998EF4:\n"
+				"BL      sub_FF9995C8\n" //; jumptable FF998E3C case 6
+				"BL      sub_FF996C88\n"
+				"B       loc_FF998F8C\n"
+ "loc_FF998F00:\n"
+				"BL      sub_FF998B2C\n" //; jumptable FF998E3C case 7
+				"B       loc_FF998F8C\n"
+ "loc_FF998F08:\n"
+				"BL      sub_FF99963C\n" // ; jumptable FF998E3C case 8
+				"BL      sub_FF996C88\n"
+				"B       loc_FF998F8C\n"
+ "loc_FF998F14:\n"
+				"BL      sub_FF999460\n" // BackLightDrv_LcdBackLightOff_4 ; jumptable FF998E3C case 9
+				"B       loc_FF998F8C\n"
+ "loc_FF998F1C:\n"
+				"BL      sub_FF99AD1C\n" //; jumptable FF998E3C case 10
+				"B       loc_FF998F8C\n"
+ "loc_FF998F24:\n"
+				"BL      sub_FF99AEF0\n" // ; jumptable FF998E3C case 11
+				"B       loc_FF998F8C\n"
+ "loc_FF998F2C:\n"
+				"BL      sub_FF99AF84\n" // ; jumptable FF998E3C case 12
+				"B       loc_FF998F8C\n"
+ "loc_FF998F34:\n"
+				"BL      sub_FF99B020\n" //  ; jumptable FF998E3C case 13
+				"B       loc_FF998F8C\n"
+ "loc_FF998F3C:\n"
+				"MOV     R0, #0\n"       // ; jumptable FF998E3C case 14
+				"BL      sub_FF99B28C\n"
+				"B       loc_FF998F8C\n"
+ "loc_FF998F48:\n"
+				"BL      sub_FF99B460\n" // ; jumptable FF998E3C case 15
+				"B       loc_FF998F8C\n"
+ "loc_FF998F50:\n"
+				"BL      sub_FF99B4F8\n" // ; jumptable FF998E3C case 16
+				"B       loc_FF998F8C\n"
+ "loc_FF998F58:\n"
+				"BL      sub_FF99B5B4\n" // ; jumptable FF998E3C case 17
+				"B       loc_FF998F8C\n"
+ "loc_FF998F60:\n"
+				"BL      sub_FF999830\n" // ; jumptable FF998E3C case 18
+				"BL      sub_FF998884\n"
+				"B       loc_FF998F8C\n"
+ "loc_FF998F6C:\n"
+				"BL      sub_FF99B160\n" // ; jumptable FF998E3C case 19
+				"B       loc_FF998F8C\n"
+ "loc_FF998F74:\n"
+				"BL      sub_FF99B1B8\n" // ; jumptable FF998E3C case 20
+				"B       loc_FF998F8C\n"
+ "loc_FF998F7C:\n"
+				"MOV     R1, #0x4E0\n" // ; default
+				"LDR     R0, =0xFF9986E0\n" // aShoottask_c
+				"ADD     R1, R1, #7\n"
+				"BL      sub_FF813E84\n" // DebugAssert
+ "loc_FF998F8C:\n"
+				"LDR     R2, [SP]\n"
+ "loc_FF998F90:\n"
+				"LDR     R3, =0x8C424\n" // ; jumptable FF998E3C case 21
+				"LDR     R1, [R2,#4]\n"
+				"LDR     R0, [R3]\n"
+				"BL      sub_FF820E2C\n" // SetEventFlag
+				"LDR     R0, [SP]\n"
+				"BL      sub_FF99875C\n"
+ "loc_FF998FA8:\n"
+				"LDR     R3, =0x8C428\n"
+				"MOV     R1, R4\n"
+				"LDR     R0, [R3]\n"
+				"MOV     R2, #0\n"
+				"BL      sub_FF821544\n" // ReceiveMessageQueue
+				"TST     R0, #1\n"
+				"BEQ     loc_FF998E2C\n"
+				"LDR     R0, =0xFF9986E0\n" // aShoottask_c
+				"MOV     R1, #0x410\n"
+				"ADD     R1, R1, #9\n"
+				"BL      sub_FF813E84\n" // DebugAssert
+				"BL      sub_FF822AA0\n" // ExitTask
+                "ADD     SP, SP, #4\n"
+                "LDMFD   SP!, {R4,PC}\n"
+	);
+}
+
Index: /trunk/platform/ixus850_sd800/sub/100e/stubs_entry.S
===================================================================
--- /trunk/platform/ixus850_sd800/sub/100e/stubs_entry.S	(revision 511)
+++ /trunk/platform/ixus850_sd800/sub/100e/stubs_entry.S	(revision 511)
@@ -0,0 +1,170 @@
+// !!! THIS FILE IS GENERATED. DO NOT EDIT. !!!
+#include "stubs_asm.h"
+
+NSTUB(AllocateMemory, 0xff811ab0)
+NSTUB(AllocateUncacheableMemory, 0xff814fb4)
+NSTUB(Close, 0xff87a40c)
+NSTUB(CreatePhysicalVram, 0xff960d4c)
+NSTUB(CreateTask, 0xff8226e0)
+NSTUB(CreateTaskStrict, 0xff823780)
+NSTUB(DisableDispatch, 0xff822504)
+// Best match: 93%
+NSTUB(DisplayImagePhysicalScreen, 0xff95ffdc)
+// ALT: NSTUB(DisplayImagePhysicalScreen, 0xff95ffdc) // 29/2
+NSTUB(EnableDispatch, 0xff822590)
+NSTUB(ExecuteEventProcedure, 0xff816e50)
+NSTUB(ExitTask, 0xff822aa0)
+NSTUB(Fclose_Fut, 0xff873440)
+NSTUB(Fopen_Fut, 0xff873400)
+NSTUB(Fread_Fut, 0xff8734fc)
+NSTUB(FreeMemory, 0xff811abc)
+NSTUB(FreeUncacheableMemory, 0xff814fe8)
+NSTUB(Fseek_Fut, 0xff8735f0)
+NSTUB(Fwrite_Fut, 0xff873550)
+NSTUB(GetCurrentAvValue, 0xffb132b0)
+// ALT: NSTUB(GetCurrentAvValue, 0xffb15558) // 13/0
+NSTUB(GetCurrentTargetDistance, 0xffb15500)
+// Best match: 83%
+NSTUB(GetFocusLensSubjectDistance, 0xffb021e8)
+// ALT: NSTUB(GetFocusLensSubjectDistance, 0xffb021e8) // 26/5
+// Best match: 92%
+NSTUB(GetFocusLensSubjectDistanceFromLens, 0xffb02754)
+NSTUB(GetParameterData, 0xff9b2e94)
+// Best match: 92%
+NSTUB(GetPropertyCase, 0xff825a14)
+// Best match: 96%
+NSTUB(GetSystemTime, 0xff8151ec)
+// ALT: NSTUB(GetSystemTime, 0xff8151ec) // 26/1
+// Best match: 93%
+NSTUB(GetZoomLensCurrentPoint, 0xffaf30e4)
+// ALT: NSTUB(GetZoomLensCurrentPoint, 0xffaf30e4) // 27/2
+// Best match: 93%
+NSTUB(GetZoomLensCurrentPosition, 0xffaf30f8)
+// ALT: NSTUB(GetZoomLensCurrentPosition, 0xffaf30f8) // 27/2
+NSTUB(IsStrobeChargeCompleted, 0xff938088)
+NSTUB(LockMainPower, 0xff9ae080)
+NSTUB(MakeDirectory, 0xff87a720)
+// Best match: 90%
+NSTUB(Mount_FileSystem, 0xff879734)
+// ALT: NSTUB(Mount_FileSystem, 0xff879734) // 27/3
+// Best match: 96%
+NSTUB(MoveFocusLensToDistance, 0xffb157a0)
+NSTUB(MoveZoomLensWithPoint, 0xffaf2fc4)
+// ALT: NSTUB(MoveZoomLensWithPoint, 0xffaf2fc4) // 25/0
+NSTUB(Open, 0xff87a3e4)
+// Best match: 96%
+NSTUB(PhySw_testgpio, 0xff829398)
+NSTUB(ProtectFile, 0xff8729f0)
+// Best match: 92%
+NSTUB(PutInNdFilter, 0xffb134a4)
+// ALT: NSTUB(PutInNdFilter, 0xffb134a4) // 25/2
+// Best match: 94%
+NSTUB(PutOutNdFilter, 0xffb134ec)
+// ALT: NSTUB(PutOutNdFilter, 0xffb134ec) // 16/1
+NSTUB(Read, 0xff87a4a0)
+NSTUB(RefreshPhysicalScreen, 0xff9c3e2c)
+NSTUB(Remove, 0xff87a42c)
+NSTUB(SetAutoShutdownTime, 0xff9adf84)
+NSTUB(SetParameterData, 0xff9b2db4)
+NSTUB(SetPropertyCase, 0xff8258c4)
+NSTUB(SleepTask, 0xff8225f4)
+NSTUB(TakeSemaphore, 0xff8220f0)
+NSTUB(UnlockMainPower, 0xff9ae118)
+NSTUB(Unmount_FileSystem, 0xff8797d8)
+// Best match: 89%
+NSTUB(UnsetZoomForMovie, 0xff9e9470)
+NSTUB(UpdateMBROnFlash, 0xff87992c)
+// Best match: 96%
+NSTUB(VbattGet, 0xff82d38c)
+NSTUB(Write, 0xff87a4ac)
+NSTUB(_log, 0xffb53b6c)
+// ALT: NSTUB(_log, 0xffb53b6c) // 27/0
+NSTUB(_log10, 0xffb4fbf0)
+// ALT: NSTUB(_log10, 0xffb4fbf0) // 27/0
+NSTUB(_pow, 0xffb4fd78)
+// ALT: NSTUB(_pow, 0xffb4fd78) // 25/0
+NSTUB(_sqrt, 0xffb51f68)
+// ALT: NSTUB(_sqrt, 0xffb51f68) // 24/0
+NSTUB(chdir, 0xffb5ee34)
+// ALT: NSTUB(chdir, 0xffb5ee34) // 27/0
+NSTUB(close, 0xffb5e774)
+NSTUB(closedir, 0xffb5bbfc)
+// ERROR: free is not found!
+NSTUB(ints_disable, 0xff81e3e4)
+NSTUB(ints_enable, 0xff81e3f0)
+NSTUB(ioctl, 0xffb5e8b4)
+NSTUB(iosDevAdd, 0xffb5f994)
+NSTUB(iosDrvInstall, 0xffb5fc58)
+NSTUB(isalpha, 0xffb55b70)
+// ALT: NSTUB(isalpha, 0xffb55b70) // 4/0
+NSTUB(isdigit, 0xffb55ba0)
+// ALT: NSTUB(isdigit, 0xffb55ba0) // 4/0
+NSTUB(islower, 0xffb55bd0)
+// ALT: NSTUB(islower, 0xffb55bd0) // 4/0
+NSTUB(isspace, 0xffb55c18)
+// ALT: NSTUB(isspace, 0xffb55c18) // 4/0
+NSTUB(isupper, 0xffb55c30)
+// ALT: NSTUB(isupper, 0xffb55c30) // 4/0
+NSTUB(kbd_p1_f, 0xff8280bc)
+NSTUB(kbd_p1_f_cont, 0xff8280c8)
+NSTUB(kbd_p2_f, 0xff8284a0)
+// Best match: 83%
+NSTUB(kbd_pwr_off, 0xff829354)
+// ALT: NSTUB(kbd_pwr_off, 0xff829370) // 5/1
+// ALT: NSTUB(kbd_pwr_off, 0xff82a4e8) // 5/1
+// ALT: NSTUB(kbd_pwr_off, 0xff82a504) // 5/1
+// Best match: 55%
+NSTUB(kbd_pwr_on, 0xff961d24)
+// ALT: NSTUB(kbd_pwr_on, 0xff961d50) // 5/4
+// ERROR: kbd_read_keys_r2 is not found!
+// Best match: 93%
+NSTUB(localtime, 0xffb5a3f0)
+NSTUB(lseek, 0xffb5e8b8)
+// Best match: 53%
+NSTUB(malloc, 0xffb617b4)
+// ALT: NSTUB(malloc, 0xffb617b4) // 15/13
+NSTUB(memcmp, 0xffb597d0)
+// ALT: NSTUB(memcmp, 0xffb65974) // 9/0
+NSTUB(memcpy, 0xffb5980c)
+NSTUB(memset, 0xffb59884)
+NSTUB(mkdir, 0xff87a664)
+NSTUB(open, 0xffb5edb8)
+NSTUB(opendir, 0xffb5bc30)
+NSTUB(qsort, 0xffb59030)
+NSTUB(rand, 0xffb59054)
+// ALT: NSTUB(rand, 0xffb59054) // 8/0
+NSTUB(read, 0xffb5e7d4)
+NSTUB(readdir, 0xffb5bbc8)
+NSTUB(rename, 0xffb5edc0)
+// ALT: NSTUB(rename, 0xffb5edc0) // 26/0
+NSTUB(rewinddir, 0xffb5bbf0)
+NSTUB(srand, 0xffb59078)
+// ALT: NSTUB(srand, 0xffb59078) // 4/0
+NSTUB(stat, 0xffb5bcc4)
+NSTUB(strcat, 0xffb598a4)
+NSTUB(strchr, 0xffb598d0)
+NSTUB(strcmp, 0xffb598f4)
+NSTUB(strcpy, 0xffb59a88)
+NSTUB(strlen, 0xffb59bec)
+NSTUB(strncmp, 0xffb59c50)
+NSTUB(strncpy, 0xffb59c94)
+// ALT: NSTUB(strncpy, 0xffb59c94) // 24/0
+NSTUB(strpbrk, 0xffb59cdc)
+NSTUB(strrchr, 0xffb59d18)
+// ALT: NSTUB(strrchr, 0xffb59d18) // 8/0
+NSTUB(strtol, 0xffb5946c)
+NSTUB(taskCreateHookAdd, 0xffb64414)
+NSTUB(taskDeleteHookAdd, 0xffb64350)
+// Best match: 82%
+NSTUB(taskIdListGet, 0xffb6e3dc)
+NSTUB(taskLock, 0xffb6ea98)
+NSTUB(taskName, 0xffb6e2d4)
+NSTUB(taskResume, 0xffb6e6b8)
+NSTUB(taskSuspend, 0xffb6e4e4)
+NSTUB(taskUnlock, 0xffb6eb40)
+NSTUB(time, 0xffb5b13c)
+// ALT: NSTUB(time, 0xffb5b13c) // 25/0
+NSTUB(utime, 0xffb5bd58)
+// ALT: NSTUB(utime, 0xffb5bd58) // 26/0
+NSTUB(vsprintf, 0xffb5d51c)
+NSTUB(write, 0xffb5e844)
Index: /trunk/platform/ixus850_sd800/sub/100e/stubs_entry_2.S
===================================================================
--- /trunk/platform/ixus850_sd800/sub/100e/stubs_entry_2.S	(revision 511)
+++ /trunk/platform/ixus850_sd800/sub/100e/stubs_entry_2.S	(revision 511)
@@ -0,0 +1,46 @@
+#include "stubs_asm.h"
+
+NHSTUB(free, 0xFFB617C0)
+NHSTUB(Open, 0xFF87A3E4)	// before Close
+NHSTUB(Rename, 0xFF87A4CC)	// after Write
+
+NSTUB(kbd_p1_f, 0xFF8280BC) // ok
+NSTUB(kbd_p1_f_cont, 0xFF8280C8) // ok
+NSTUB(kbd_p2_f, 0xFF8284A0) // ok
+NHSTUB(kbd_pwr_off, 0xFF82930C) // corrected
+NHSTUB(kbd_pwr_on, 0xFF8292CC) // corrected
+NHSTUB(kbd_read_keys_r2, 0xFF828E30) // added
+
+NSTUB(GetCurrentAvValue, 0xFFB132B0)
+
+NHSTUB(AllocateMemory, 0xFF81AD84)
+NHSTUB(FreeMemory, 0xFF81AD70)
+NHSTUB(GetFocusLensSubjectDistance, 0xFFB021E8) 
+NHSTUB(SetPropertyCase, 0xFF8258C4) // see "PropertyCase.c" and refs to it
+
+NHSTUB(SetZoomActuatorSpeedPercent, 0xFF8E68F4)
+
+NHSTUB(GetDrive_ClusterSize, 0xFF879BF8)	// note "GetCatFs_ClusterSize"
+NHSTUB(GetDrive_TotalClusters, 0xFF879C34)	// note "GetCatFs_TotalClusters"
+NHSTUB(GetDrive_FreeClusters, 0xFF879C70)	// note "GetCatFs_FreeClusters"
+
+NSTUB(Fwrite_Fut, 0xFF873550)
+NSTUB(Fseek_Fut, 0xFF8735F0)
+ 
+
+NHSTUB(MFOn, 0xFF996198)
+NHSTUB(MFOff, 0xFF9961C8)
+
+NHSTUB(SetAutoShutdownTime, 0xFF9ADF84)
+NHSTUB(CreateTaskStrict, 0xFF823780)
+
+NHSTUB(ExpCtrlTool_StopContiAE,  0xFF926F10) 
+NHSTUB(ExpCtrlTool_StartContiAE, 0xFF926EE0) 
+NHSTUB(MakeAFScan,  0xFF999CF8) 
+NHSTUB(GetBatteryTemperature, 0xFF82E4F0)
+NHSTUB(GetCCDTemperature, 0xFF82E4DC)
+NHSTUB(GetOpticalTemperature, 0xFF82E4C8)
+NHSTUB(PT_PlaySound, 0xFF9A4EE8)
+
+//NHSTUB(EnterToCompensationEVF, 0xFFFFFFFF) // Stub not found. When found, remove dummy function from lib.c.
+//NHSTUB(ExitFromCompensationEVF, 0xFFFFFFFF) // Stub not found. When found, remove dummy function from lib.c.
Index: /trunk/platform/ixus850_sd800/sub/100e/boot.c
===================================================================
--- /trunk/platform/ixus850_sd800/sub/100e/boot.c	(revision 511)
+++ /trunk/platform/ixus850_sd800/sub/100e/boot.c	(revision 511)
@@ -0,0 +1,165 @@
+#include "lolevel.h"
+#include "platform.h"
+#include "core.h"
+
+const long new_sa = MEMISOSTART + MEMISOSIZE;
+
+/* Ours stuff */
+extern long wrs_kernel_bss_start;
+extern long wrs_kernel_bss_end;
+extern void createHook (void *pNewTcb);
+extern void deleteHook (void *pTcb);
+
+
+void boot();
+
+/* "relocated" functions */
+void __attribute__((naked,noinline)) h_usrInit();
+void __attribute__((naked,noinline)) h_usrKernelInit();
+void __attribute__((naked,noinline)) h_usrRoot();
+
+
+
+void boot()
+{
+    long *canon_data_src = (void*)0xFFB74640;
+    long *canon_data_dst = (void*)0x1900;
+    long canon_data_len = 0xCBB0;
+    long *canon_bss_start = (void*)0xE4B0; // 1900+data_len=E4B0
+    long canon_bss_len = 0xBA7B0 - 0xE4B0;
+    long i;
+
+    asm volatile (
+	"MRC     p15, 0, R0,c1,c0\n"
+	"ORR     R0, R0, #0x1000\n"
+	"ORR     R0, R0, #4\n"
+	"ORR     R0, R0, #1\n"
+	"MCR     p15, 0, R0,c1,c0\n"
+    :::"r0");
+
+    for(i=0;i<canon_data_len/4;i++)
+	canon_data_dst[i]=canon_data_src[i];
+
+    for(i=0;i<canon_bss_len/4;i++)
+	canon_bss_start[i]=0;
+
+    asm volatile (
+	"MRC     p15, 0, R0,c1,c0\n"
+	"ORR     R0, R0, #0x1000\n"
+	"BIC     R0, R0, #4\n"
+	"ORR     R0, R0, #1\n"
+	"MCR     p15, 0, R0,c1,c0\n"
+    :::"r0");
+
+    h_usrInit();
+}
+
+
+void h_usrInit()
+{
+    asm volatile (
+	"STR     LR, [SP,#-4]!\n"
+	"BL      sub_FF811968\n"
+	"MOV     R0, #2\n"
+	"MOV     R1, R0\n"
+	"BL      sub_FFB5B17C\n"
+	"BL      sub_FFB4D9A4\n" //excVecInit
+	"BL      sub_FF8111C4\n" // sysInitStack
+	"BL      sub_FF811728\n"
+	"LDR     LR, [SP],#4\n"
+	"B       h_usrKernelInit\n" // !! has to be here
+    );
+}
+
+void  h_usrKernelInit()
+{
+    asm volatile (
+	"STMFD   SP!, {R4,LR}\n"
+	"SUB     SP, SP, #8\n"
+	"BL      sub_FFB5B67C\n" //classLibInit
+	"BL      sub_FFB6E464\n" //taskLibInit
+	"LDR     R3, =0xD4C8\n"
+	"LDR     R2, =0xB7200\n"
+	"LDR     R1, [R3]\n"
+	"LDR     R0, =0xBA170\n"
+	"MOV     R3, #0x100\n"
+	"BL      sub_FFB67574\n" //qInit
+	"LDR     R3, =0xD488\n"
+	"LDR     R0, =0xDCD0\n"
+	"LDR     R1, [R3]\n"
+	"BL      sub_FFB67574\n" //qInit
+	"LDR     R3, =0xD544\n"
+	"LDR     R0, =0xBA144\n"
+	"LDR     R1, [R3]\n"
+	"BL      sub_FFB67574\n" //qInit
+	"BL      sub_FFB72820\n" //workQInit
+	"BL      sub_FF8112AC\n"
+	"MOV     R4, #0\n"
+	"MOV     R3, R0\n"
+	"MOV     R12, #0x800\n"
+	"LDR     R0, =h_usrRoot\n" // R0, =sub_FF811A60 (h_usrRoot))
+	"MOV     R1, #0x4000\n"
+    );    
+//        "LDR     R2, =0xEA7B0\n"	// 0xBA7B0 + 0x30000
+    asm volatile (
+        "LDR     R2, =new_sa\n"
+        "LDR     R2, [R2]\n"
+    );
+    asm volatile (
+	"STR     R12, [SP]\n"
+	"STR     R4, [SP,#4]\n"
+	"BL      sub_FFB6B6A4\n" //kernelInit
+	"ADD     SP, SP, #8\n"
+	"LDMFD   SP!, {R4,PC}\n"
+    );
+}
+
+static long drv_struct[16];
+ 
+static long dh_err()
+{
+    return -1;
+}
+
+static void drv_self_hide()
+{
+    long drvnum;
+    
+    drvnum = _iosDrvInstall(dh_err,dh_err,dh_err,dh_err,dh_err,dh_err,dh_err);
+    if (drvnum >= 0)
+	_iosDevAdd(drv_struct, "A/DISKBOOT.BIN", drvnum);
+}
+
+
+void  h_usrRoot()
+{
+    asm volatile (
+	"STMFD   SP!, {R4,R5,LR}\n"
+	"MOV     R5, R0\n"
+	"MOV     R4, R1\n"
+	"BL      sub_FF8119D0\n"
+	"MOV     R1, R4\n"
+	"MOV     R0, R5\n"
+	"BL      sub_FFB60310\n" //memInit
+	"MOV     R1, R4\n"
+	"MOV     R0, R5\n"
+	"BL      sub_FFB60D88\n" //memPartLibInit
+//	"BL      sub_FF8117E8\n" // nullsub 3
+	"BL      sub_FF811704\n"
+	"BL      sub_FF811A0C\n"
+	"BL      sub_FF8119F0\n"
+	"BL      sub_FF811A38\n"
+	"BL      sub_FF8119C4\n"
+    );
+
+    _taskCreateHookAdd(createHook);
+    _taskDeleteHookAdd(deleteHook);
+
+    drv_self_hide();
+
+    asm volatile (
+	"LDMFD   SP!, {R4,R5,LR}\n"
+	"B       sub_FF81136C\n" //IsEmptyWriteCache_2
+    );
+}
+
Index: /trunk/platform/ixus850_sd800/sub/100e/stubs_min.S
===================================================================
--- /trunk/platform/ixus850_sd800/sub/100e/stubs_min.S	(revision 511)
+++ /trunk/platform/ixus850_sd800/sub/100e/stubs_min.S	(revision 511)
@@ -0,0 +1,226 @@
+#include "stubs_asm.h"
+
+/*******************
+ROM:FF828060 loc_FF828060                            ; CODE XREF: sub_FF828044+14j
+ROM:FF828060                 LDR     R3, =physw_status <------ 0x0000FB60
+ROM:FF828064                 LDR     R0, [R3,R4,LSL#2]
+ROM:FF828068                 LDMFD   SP!, {R4,PC}
+ROM:FF828068 ; End of function sub_FF828044
+ROM:FF828068
+ROM:FF828068 ; ---------------------------------------------------------------------------
+ROM:FF82806C off_FF82806C    DCD aPhysw_c            ; DATA XREF: sub_FF828044+10r
+ROM:FF82806C                                         ; "PhySw.c"
+ROM:FF828070 off_FF828070    DCD physw_status        ; DATA XREF: sub_FF828044:loc_FF828060r
+ROM:FF828074
+ROM:FF828074 ; =============== S U B R O U T I N E =======================================
+ROM:FF828074
+ROM:FF828074 ; Attributes: noreturn
+ROM:FF828074
+ROM:FF828074 PhySw_task                              ; DATA XREF: ROM:off_FF828038o
+ROM:FF828074                 STMFD   SP!, {R4,LR}
+ROM:FF828078                 LDR     R2, =physw_run <------ 0x00001FDC
+ROM:FF82807C                 LDR     R3, [R2]
+ROM:FF828080                 CMP     R3, #0
+ROM:FF828084                 BEQ     loc_FF8280B0
+ROM:FF828088                 MOV     R4, R2
+
+ROM:FF8280B4 ; ---------------------------------------------------------------------------
+ROM:FF8280B8 off_FF8280B8    DCD physw_run           ; DATA XREF: PhySw_task+4r
+ROM:FF8280BC
+ROM:FF8280BC ; =============== S U B R O U T I N E =======================================
+ROM:FF8280BC
+ROM:FF8280BC
+ROM:FF8280BC kbd_p1_f                                ; CODE XREF: PhySw_task+20p
+ROM:FF8280BC                 STMFD   SP!, {R4-R7,LR}
+ROM:FF8280C0                 SUB     SP, SP, #0xC
+ROM:FF8280C4                 BL      kbd_read_keys
+ROM:FF8280C8                 LDR     R7, =physw_status ; kbd_p1_f_cont
+ROM:FF8280CC                 MOV     R6, SP
+ROM:FF8280D0                 LDR     R5, =unk_FB40
+ROM:FF8280D4                 LDR     R4, =unk_FB50
+ROM:FF8280D8                 MOV     R12, #2
+ROM:FF8280DC                 MOV     LR, R6
+
+*******************/
+
+DEF(physw_status, 0xFB60)	// see PhySw task at FF828074, dword above PhySw_task, 
+DEF(physw_run, 0x1FDC)		// dword above kbd_p1_f, used by PhySw_task
+
+/************
+ROM:FFAF175C                 LDR     R3, =unk_97B50
+ROM:FFAF1760                 LDR     R12, =zoom_busy_0 <--- 0x00097B2C
+ROM:FFAF1764                 LDR     R4, =unk_97B28
+ROM:FFAF1768                 STR     R0, [R3]
+ROM:FFAF176C                 MOV     R2, #0x10
+ROM:FFAF1770                 STR     R5, [R12]
+ROM:FFAF1774                 MOV     R1, #0xA
+ROM:FFAF1778                 LDR     R0, =aZoomlens
+ROM:FFAF177C                 STR     R5, [R4]
+ROM:FFAF1780                 BL      sub_FFAEA8A4
+ROM:FFAF1784                 STR     R0, [R6]
+ROM:FFAF1788                 BL      taskcreate_ZoomEvent
+*************/
+
+DEF(zoom_busy, 0x97B2C)		// "ZoomLens"
+
+/**************
+ROM:FFB016EC aFocuslens      DCB "FocusLens",0       ; DATA XREF: ROM:off_FFB017CCo
+ROM:FFB016F6                 DCB    0
+ROM:FFB016F7                 DCB    0
+ROM:FFB016F8
+ROM:FFB016F8 ; =============== S U B R O U T I N E =======================================
+ROM:FFB016F8
+ROM:FFB016F8
+ROM:FFB016F8 sub_FFB016F8                            ; CODE XREF: taskcreate_ISCPUInitTask+14p
+ROM:FFB016F8                 STMFD   SP!, {R4-R6,LR}
+ROM:FFB016FC                 LDR     R6, =dword_A9B0
+ROM:FFB01700                 LDR     R4, [R6]
+ROM:FFB01704                 CMP     R4, #0
+ROM:FFB01708                 LDR     R0, =unk_97E70
+ROM:FFB0170C                 LDR     R5, =unk_97E6C
+ROM:FFB01710                 LDMNEFD SP!, {R4-R6,PC}
+ROM:FFB01714                 BL      sub_FFAFC2AC
+ROM:FFB01718                 BL      sub_FFB03240
+ROM:FFB0171C                 MOV     R1, #1
+ROM:FFB01720                 MOV     R0, R4
+ROM:FFB01724                 BL      CreateBinarySemaphoreStrictly
+ROM:FFB01728                 LDR     R3, =unk_97E64
+ROM:FFB0172C                 MOV     R1, #1
+ROM:FFB01730                 STR     R0, [R3]
+ROM:FFB01734                 MOV     R0, R4
+ROM:FFB01738                 BL      CreateBinarySemaphoreStrictly
+ROM:FFB0173C                 LDR     R3, =unk_97E68
+ROM:FFB01740                 LDR     R2, =unk_97E24
+ROM:FFB01744                 STR     R0, [R3]
+ROM:FFB01748                 LDR     R12, =unk_97E28
+ROM:FFB0174C                 LDR     R3, =focus_busy_0 <--------- 0x00097E20
+ROM:FFB01750                 MOV     R0, R4
+ROM:FFB01754                 STR     R4, [R3]
+
+**************/
+
+DEF(focus_busy, 0x97E20)	// "FocusLens"
+
+DEF(playrec_mode, 0x6DF4)	// in the first called f-n in task_SsStartupTask
+
+/*************
+sub_FF9B4150                            ; CODE XREF: sub_FF9B2E94+A4p
+ROM:FF9B4150                 MOV     R0, R0,LSL#16
+ROM:FF9B4154                 MOV     R3, R3,LSL#16
+ROM:FF9B4158                 MOV     R0, R0,LSR#16
+ROM:FF9B415C                 STMFD   SP!, {R4-R8,LR}
+ROM:FF9B4160                 MOV     R7, R2
+ROM:FF9B4164                 MOV     R8, R1
+ROM:FF9B4168                 MOV     R4, R3,ASR#16
+ROM:FF9B416C                 BL      sub_FF9B0A18 <-----------
+ROM:FF9B4170                 MOV     R5, R0
+ROM:FF9B4174                 LDRH    R3, [R5,#4]
+ROM:FF9B4178                 BIC     R3, R3, #3
+ROM:FF9B417C                 MOV     R3, R3,LSL#16
+ROM:FF9B4180                 LDR     R2, =unk_911E0
+ROM:FF9B4184                 MOV     R3, R3,LSR#16
+ROM:FF9B4188                 ADD     R3, R3, R2
+ROM:FF9B418C                 CMP     R7, #0
+ROM:FF9B4190                 LDR     R0, =aParameterManager_c
+ROM:FF9B4194                 MOV     R1, #0x94 ; 'ö'
+ROM:FF9B4198                 ADD     R6, R3, #5
+ROM:FF9B419C                 BNE     loc_FF9B41A4
+ROM:FF9B41A0                 BL      DebugAssert
+ROM:FF9B41A4
+ROM:FF9B41A4 loc_FF9B41A4                            ; CODE XREF: sub_FF9B4150+4Cj
+ROM:FF9B41A4                 MOV     R3, R4,LSL#16
+ROM:FF9B41A8                 LDRH    R2, [R5,#6]
+ROM:FF9B41AC                 MOV     R4, R3,LSR#16
+ROM:FF9B41B0                 CMP     R4, R2
+ROM:FF9B41B4                 LDR     R0, =aParameterManager_c
+ROM:FF9B41B8                 MOV     R1, #0x95 ; 'ò'
+ROM:FF9B41BC                 BLS     loc_FF9B41C4
+ROM:FF9B41C0                 BL      DebugAssert
+ROM:FF9B41C4
+ROM:FF9B41C4 loc_FF9B41C4                            ; CODE XREF: sub_FF9B4150+6Cj
+ROM:FF9B41C4                 MOV     R0, R8
+ROM:FF9B41C8                 MOV     R1, R6
+ROM:FF9B41CC                 MOV     R2, R4
+ROM:FF9B41D0                 LDRH    R3, [R5,#8]
+ROM:FF9B41D4                 BL      sub_FF9B4454
+ROM:FF9B41D8                 MOV     R0, R7
+ROM:FF9B41DC                 MOV     R2, R4
+ROM:FF9B41E0                 MOV     R1, R6
+ROM:FF9B41E4                 LDMFD   SP!, {R4-R8,LR}
+ROM:FF9B41E8                 B       memcpy
+ROM:FF9B41E8 ; End of function sub_FF9B4150
+ROM:FF9B41E8
+ROM:FF9B41E8 ; -------------------------------------------------------
+
+
+
+ROM:FF9B0A18 sub_FF9B0A18                            ; CODE XREF: sub_FF9B3FB8+18p
+ROM:FF9B0A18                                         ; sub_FF9B4084+24p ...
+ROM:FF9B0A18                 STMFD   SP!, {R4,LR}
+ROM:FF9B0A1C                 MOV     R4, R0
+ROM:FF9B0A20                 MOV     R1, #0x1340
+ROM:FF9B0A24                 CMP     R4, #0x6D ; 'm'
+ROM:FF9B0A28                 ADD     R1, R1, #0x1E
+ROM:FF9B0A2C                 LDR     R0, =aPropertytable_c
+ROM:FF9B0A30                 BLS     loc_FF9B0A38
+ROM:FF9B0A34                 BL      DebugAssert
+ROM:FF9B0A38
+ROM:FF9B0A38 loc_FF9B0A38                            ; CODE XREF: sub_FF9B0A18+18j
+ROM:FF9B0A38                 LDR     R3, =FlashParamsTable <-- 0xFF9B0860
+ROM:FF9B0A3C                 LDR     R0, [R3,R4,LSL#2]
+ROM:FF9B0A40                 LDMFD   SP!, {R4,PC}
+
+*************/
+DEF(FlashParamsTable, 0xFF9B0860)
+
+
+/**********
+
+ROM:FFA53D10 StartRecModeMenu                        ; CODE XREF: sub_FF9DE684+28p
+ROM:FFA53D10                                         ; sub_FF9E6904+3B8p
+ROM:FFA53D10                                         ; DATA XREF: ...
+ROM:FFA53D10                 STMFD   SP!, {R4-R7,LR}
+ROM:FFA53D14                 LDR     R5, =canon_menu_active <-----0x00009054
+ROM:FFA53D18                 LDR     R2, =canon_menu_active2
+ROM:FFA53D1C                 LDR     R3, [R5]
+
+**********/
+
+DEF(canon_menu_active,0x9054)		// after "StartRecModeMenu", LDR R4, =0x9054
+
+/************
+ROM:FF9F3298 taskcreate_DSITask                      ; CODE XREF: sub_FF9DDDA0+40p
+ROM:FF9F3298
+ROM:FF9F3298 var_10          = -0x10
+ROM:FF9F3298
+ROM:FF9F3298                 STMFD   SP!, {R4,R5,LR}
+ROM:FF9F329C                 LDR     R5, =dword_7EDC
+
+************/
+
+DEF(canon_shoot_menu_active,0x7ED9) // (0x7EDC - 0x4 + 0x1) found in "taskcreate_DSITask"
+
+/************
+ROM:FF9E59C8 aArSnd0x04x     DCB "AR:Snd:0x%04x",0   ; DATA XREF: ROM:off_FF9E5A54o
+ROM:FF9E59D6                 DCB    0
+ROM:FF9E59D7                 DCB    0
+ROM:FF9E59D8
+ROM:FF9E59D8 ; =============== S U B R O U T I N E =======================================
+ROM:FF9E59D8
+ROM:FF9E59D8
+ROM:FF9E59D8 sub_FF9E59D8                            ; CODE XREF: sub_FF9E5B84-11Cj
+ROM:FF9E59D8                                         ; sub_FF9E5A6C+10j ...
+ROM:FF9E59D8
+ROM:FF9E59D8 var_D           = -0xD
+ROM:FF9E59D8
+ROM:FF9E59D8                 STMFD   SP!, {R4,R5,LR}
+ROM:FF9E59DC                 LDR     R3, =dword_7CF4
+ROM:FF9E59E0                 SUB     SP, SP, #4
+
+************/
+
+
+DEF(recreview_hold, 0x7CF0) // (0x7CF4 - 0x4) found in "AR:Snd:0x%04x", LDR R3, =0x7CF4;
+DEF(zoom_status, 0x7DB0)
+DEF(movie_status, 0x8BC00)
+DEF(some_flag_for_af_scan, 0x6AE0)
Index: /trunk/platform/ixus850_sd800/sub/100e/makefile.inc
===================================================================
--- /trunk/platform/ixus850_sd800/sub/100e/makefile.inc	(revision 511)
+++ /trunk/platform/ixus850_sd800/sub/100e/makefile.inc	(revision 511)
@@ -