| 1 | #include "lolevel.h" |
|---|
| 2 | #include "platform.h" |
|---|
| 3 | #include "core.h" |
|---|
| 4 | #include "keyboard.h" |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | extern long link_bss_start; |
|---|
| 9 | extern long link_bss_end; |
|---|
| 10 | extern void boot(); |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | void startup() |
|---|
| 14 | { |
|---|
| 15 | long *bss = &link_bss_start; |
|---|
| 16 | long *ptr; |
|---|
| 17 | |
|---|
| 18 | // sanity check |
|---|
| 19 | if ((long)&link_bss_end > (MEMISOSTART + MEMISOSIZE)){ |
|---|
| 20 | started(); |
|---|
| 21 | shutdown(); |
|---|
| 22 | } |
|---|
| 23 | |
|---|
| 24 | // initialize .bss senment |
|---|
| 25 | while (bss<&link_bss_end) |
|---|
| 26 | *bss++ = 0; |
|---|
| 27 | |
|---|
| 28 | boot(); |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | static struct { |
|---|
| 32 | int hackmode; |
|---|
| 33 | int canonmode; |
|---|
| 34 | } modemap[] = { |
|---|
| 35 | { MODE_AUTO, 32768 }, |
|---|
| 36 | { MODE_P, 32772 }, |
|---|
| 37 | { MODE_TV, 32771 }, |
|---|
| 38 | { MODE_AV, 32770 }, |
|---|
| 39 | { MODE_M, 32769 }, |
|---|
| 40 | { MODE_VIDEO_STD, 2597 }, |
|---|
| 41 | { MODE_VIDEO_HIRES, 2600 }, |
|---|
| 42 | { MODE_VIDEO_COMPACT, 2599 }, |
|---|
| 43 | { MODE_VIDEO_COLOR_SWAP, 2596 }, |
|---|
| 44 | { MODE_VIDEO_COLOR_ACCENT, 2595 }, |
|---|
| 45 | { MODE_VIDEO_TIME_LAPSE, 2601 }, |
|---|
| 46 | { MODE_STITCH, 33290 }, |
|---|
| 47 | { MODE_PORTRAIT, 16397 }, |
|---|
| 48 | { MODE_SCN_NIGHT, 16398 }, |
|---|
| 49 | { MODE_NIGHT_SNAPSHOT, 16395 }, |
|---|
| 50 | { MODE_SCN_INDOOR, 16401 }, |
|---|
| 51 | { MODE_SCN_SNOW, 16403 }, |
|---|
| 52 | { MODE_SCN_FIREWORK, 16405 }, |
|---|
| 53 | { MODE_SCN_WATER, 16406 }, |
|---|
| 54 | { MODE_SCN_COLOR_ACCENT, 16922 }, |
|---|
| 55 | { MODE_SCN_SPORT, 16903 }, |
|---|
| 56 | { MODE_SCN_KIDS_PETS, 16400 }, |
|---|
| 57 | { MODE_SCN_FOLIAGE, 16402 }, |
|---|
| 58 | { MODE_SCN_BEACH, 16404 }, |
|---|
| 59 | { MODE_SCN_AQUARIUM, 16407 }, |
|---|
| 60 | { MODE_SCN_ISO_3200, 16412 }, |
|---|
| 61 | { MODE_SCN_COLOR_SWAP, 16923 }, |
|---|
| 62 | { MODE_LANDSCAPE, 16396 } |
|---|
| 63 | |
|---|
| 64 | }; |
|---|
| 65 | |
|---|
| 66 | #define MODESCNT (sizeof(modemap)/sizeof(modemap[0])) |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | static const int fl_tbl[] = {7400, 8210, 9040, 9860, 10670, 12730, 14780, 16820, 18890, 21970, 25030, 29170, 36780, 44400}; |
|---|
| 70 | #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) |
|---|
| 71 | #define CF_EFL 47297 |
|---|
| 72 | |
|---|
| 73 | const int zoom_points = NUM_FL; |
|---|
| 74 | |
|---|
| 75 | int get_effective_focal_length(int zp) { |
|---|
| 76 | return (CF_EFL*get_focal_length(zp))/10000; |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | int get_focal_length(int zp) { |
|---|
| 80 | if (zp<0) return fl_tbl[0]; |
|---|
| 81 | else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; |
|---|
| 82 | else return fl_tbl[zp]; |
|---|
| 83 | } |
|---|
| 84 | |
|---|
| 85 | int get_zoom_x(int zp) { |
|---|
| 86 | if (zp<1) return 10; |
|---|
| 87 | else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; |
|---|
| 88 | else return fl_tbl[zp]*10/fl_tbl[0]; |
|---|
| 89 | } |
|---|
| 90 | |
|---|
| 91 | |
|---|
| 92 | int mode_get() { |
|---|
| 93 | int mode, i, t=0xFF; |
|---|
| 94 | |
|---|
| 95 | mode = (playrec_mode==2)?MODE_REC:MODE_PLAY; |
|---|
| 96 | |
|---|
| 97 | _GetPropertyCase(PROPCASE_SHOOTING_MODE, &t, 4); |
|---|
| 98 | for (i=0; i<MODESCNT; ++i) { |
|---|
| 99 | if (modemap[i].canonmode == t) { |
|---|
| 100 | return (mode | (modemap[i].hackmode & MODE_SHOOTING_MASK)); |
|---|
| 101 | } |
|---|
| 102 | } |
|---|
| 103 | return (mode); |
|---|
| 104 | } |
|---|
| 105 | |
|---|
| 106 | long get_vbatt_min() |
|---|
| 107 | { |
|---|
| 108 | return 7000; |
|---|
| 109 | } |
|---|
| 110 | |
|---|
| 111 | long get_vbatt_max() |
|---|
| 112 | { |
|---|
| 113 | return 8300; |
|---|
| 114 | } |
|---|
| 115 | |
|---|
| 116 | |
|---|