| 1 | #include "camera.h" |
|---|
| 2 | #include "lolevel.h" |
|---|
| 3 | #include "platform.h" |
|---|
| 4 | #include "core.h" |
|---|
| 5 | #include "keyboard.h" |
|---|
| 6 | #include "stdlib.h" |
|---|
| 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 | |
|---|
| 29 | boot(); |
|---|
| 30 | } |
|---|
| 31 | |
|---|
| 32 | static struct { |
|---|
| 33 | int hackmode; |
|---|
| 34 | int canonmode; |
|---|
| 35 | } modemap[] = { |
|---|
| 36 | { MODE_AUTO, 32768 }, // PROPCASE 49 |
|---|
| 37 | { MODE_P, 32772 }, // |
|---|
| 38 | { MODE_TV, 32771 },// |
|---|
| 39 | { MODE_AV, 32770 },// |
|---|
| 40 | { MODE_M, 32769 }, // |
|---|
| 41 | { MODE_VIDEO_STD, 2597 }, |
|---|
| 42 | { MODE_VIDEO_COMPACT, 2599 }, |
|---|
| 43 | { MODE_INDOOR, 32785 }, // |
|---|
| 44 | { MODE_SCN_KIDS_PETS, 32784 }, // |
|---|
| 45 | { MODE_PORTRAIT, 32781 }, |
|---|
| 46 | { MODE_NIGHT_SNAPSHOT, 32779 }, |
|---|
| 47 | { MODE_LANDSCAPE, 32780 }, |
|---|
| 48 | { MODE_DIGITAL_MACRO, 33288 },//?? |
|---|
| 49 | { MODE_COLOR_ACCENT, 33306 }, // { MODE_SCN_COLOR_ACCENT, 33306 }, |
|---|
| 50 | { MODE_MY_COLORS, 33307 }, |
|---|
| 51 | { MODE_SCN_KIDS_PETS, 16400 }, // { MODE_SCN_CHILD, 16400 }, |
|---|
| 52 | { MODE_SCN_INDOOR, 16401 }, // { MODE_SCN_PARTY, 16401 }, |
|---|
| 53 | { MODE_SCN_FOLIAGE, 16403 }, // { MODE_SCN_GRASS, 16402 }, |
|---|
| 54 | { MODE_SCN_SNOW, 16404 }, |
|---|
| 55 | { MODE_SCN_BEACH, 16405 }, |
|---|
| 56 | { MODE_SCN_FIREWORK, 16406 }, |
|---|
| 57 | { MODE_SCN_AQUARIUM, 16408 }, |
|---|
| 58 | { MODE_SCN_WATER, 16402 }, |
|---|
| 59 | }; |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | #define MODESCNT (sizeof(modemap)/sizeof(modemap[0])) |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | static const int fl_tbl[] = {5800, 6600, 7900, 9900, 12700, 16000, 19600, 23200}; |
|---|
| 66 | #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) |
|---|
| 67 | #define CF_EFL 60345 |
|---|
| 68 | |
|---|
| 69 | const int zoom_points = NUM_FL; |
|---|
| 70 | |
|---|
| 71 | int get_effective_focal_length(int zp) { |
|---|
| 72 | return (CF_EFL*get_focal_length(zp))/10000; |
|---|
| 73 | } |
|---|
| 74 | |
|---|
| 75 | int get_focal_length(int zp) { |
|---|
| 76 | if (zp<0) return fl_tbl[0]; |
|---|
| 77 | else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; |
|---|
| 78 | else return fl_tbl[zp]; |
|---|
| 79 | } |
|---|
| 80 | |
|---|
| 81 | int get_zoom_x(int zp) { |
|---|
| 82 | if (zp<1) return 10; |
|---|
| 83 | else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; |
|---|
| 84 | else return fl_tbl[zp]*10/fl_tbl[0]; |
|---|
| 85 | } |
|---|
| 86 | |
|---|
| 87 | |
|---|
| 88 | int mode_get() { |
|---|
| 89 | int mode, i, t=0xFF; |
|---|
| 90 | |
|---|
| 91 | mode = (physw_status[1] & 0x02000000)?MODE_REC:MODE_PLAY; |
|---|
| 92 | |
|---|
| 93 | _GetPropertyCase(PROPCASE_SHOOTING_MODE, &t, 4); |
|---|
| 94 | for (i=0; i<MODESCNT; ++i) { |
|---|
| 95 | if (modemap[i].canonmode == t) { |
|---|
| 96 | return (mode | (modemap[i].hackmode & MODE_SHOOTING_MASK)); |
|---|
| 97 | } |
|---|
| 98 | } |
|---|
| 99 | return (mode); |
|---|
| 100 | } |
|---|
| 101 | |
|---|
| 102 | long get_vbatt_min() |
|---|
| 103 | { |
|---|
| 104 | return 2300; |
|---|
| 105 | } |
|---|
| 106 | |
|---|
| 107 | long get_vbatt_max() |
|---|
| 108 | { |
|---|
| 109 | return 2550; |
|---|
| 110 | } |
|---|
| 111 | |
|---|