1 #include "../generic/wrappers.c" 2 3 long lens_get_focus_pos() 4 { 5 return _GetFocusLensSubjectDistance(); 6 } 7 8 long lens_get_focus_pos_from_lens() 9 { 10 return _GetFocusLensSubjectDistanceFromLens(); 11 } 12 13 long lens_get_target_distance() 14 { 15 return _GetCurrentTargetDistance(); 16 } 17 18 /*typedef struct FILE_S { 19 int fd; // used by Read/Write 20 unsigned len; // +4 verfied in Fseek_FileStream 21 int unk0; // +8 22 unsigned pos; // +0xC verified in Fseek_FileStream 23 // unk1; // +0x10 24 // unk2; // +0x14 25 // io_buf; // +0x18 32k uncached allocated in Fopen_FileStream 26 // unk3; // +0x20 related to StartFileAccess_Sem 27 // ...name 28 } FILE; 29 */ 30 31 // these tiny inlines provide type safety, and should optimize away 32 33 typedef struct 34 { 35 unsigned long st_dev; //? 36 unsigned long st_ino; //? 37 unsigned short st_mode; //? 38 short st_nlink; //? 39 short st_uid; //? 40 short st_gid; //? 41 unsigned long st_atime; //? 42 unsigned long st_mtime; //? 43 unsigned long st_ctime; //? 44 unsigned long st_size; 45 long st_blksize; //? 46 long st_blocks; //? 47 unsigned char st_attrib; 48 int reserved1; // 49 int reserved2; // 50 int reserved3; // 51 int reserved4; // 52 int reserved5; // 53 int reserved6; // 54 }stat_type; 55 56 #define SEEK_SET 0 57 #define SEEK_CUR 1 58 #define SEEK_END 2 59 60 #define O_RDONLY 0 61 #define O_WRONLY 1 62 #define O_RDWR 2 63 64 /* 65 int _stat(char *name, void *pStat) { 66 int fd; 67 int size; 68 stat_type *tmp=pStat; 69 fd=open(name, O_RDONLY, 0777); 70 if(fd>=0) 71 { 72 size=lseek(fd,0,SEEK_END); 73 lseek(fd,0,SEEK_SET); 74 tmp->st_size=size; 75 close(fd); 76 77 return 0; 78 } 79 else 80 return -1; 81 } 82 */ 83 84 /* 85 int _rename(const char *oldname, const char *newname) 86 { 87 //FILE * fd_old; 88 //FILE *fd_new; 89 int fd_old,fd_new; 90 91 char * buffer; 92 int size_read; 93 94 fd_old = Fopen_Fut(oldname, "r+b"); 95 if(!fd_old)return -1; 96 97 fd_new = Fopen_Fut(newname, "w+b"); 98 buffer=malloc(10000); 99 100 while(1) 101 { 102 size_read=Fread_Fut(buffer,1,10000,fd_old); 103 Fwrite_Fut(buffer,size_read,1,fd_new); 104 if(size_read!=10000)break; 105 } 106 107 Fclose_Fut(fd_new); 108 Fclose_Fut(fd_old); 109 free(buffer); 110 remove(oldname); 111 return 1; 112 } 113 114 long _RenameFile_Fut(const char *oldname, const char *newname) 115 { 116 return _rename(oldname, newname); 117 } 118 */ 119 /* 120 char *_strncpy(char *dest, const char *src, long n) { 121 122 int i; 123 char c=0;//to get rid of compiler warning 124 int finished=0; 125 for(i=0;i<n;i++) 126 { 127 if(!finished) 128 { 129 c=src[i]; 130 if(!c) 131 finished=1; 132 } 133 134 dest[i]=c; 135 } 136 return dest; 137 } 138 */ 139 /* 140 char *_strrchr(const char *s, int c) { 141 142 char *last_occurance=0; 143 while(1) 144 { 145 if(*s==c)last_occurance=(char*)s; 146 else 147 if(!*s) 148 { 149 return last_occurance; 150 } 151 s++; 152 } 153 154 } 155 */ 156 /* 157 char * _strcat(char *dest, const char *src) 158 { 159 strcpy(dest + strlen(dest), src); 160 return dest; 161 } 162 */ 163 164 //-------------------------------------------------- 165 // DoMFLock : use _MFOn/_MFOff or _PT_MFOn/_PT_MFOff or _SS_MFOn/_SS_MFOff if defined in stubs_entry.S 166 // otherwise use PostLogicalEventForNotPowerType(levent_id_for_name(PressSW1andMF),0); (see sx500hs for an example) 167 168 int DoMFLock(void) 169 { 170 if (!camera_info.state.mode_play) { 171 _PT_MFOn(); 172 return(1); 173 } 174 return(0); 175 } 176 177 int UnlockMF(void) 178 { 179 if (!camera_info.state.mode_play) { 180 _PT_MFOff(); 181 return(1); 182 } 183 return(0); 184 }