| 1 | #include "platform.h" |
|---|
| 2 | #include "keyboard.h" |
|---|
| 3 | #include "stdlib.h" |
|---|
| 4 | |
|---|
| 5 | /* |
|---|
| 6 | void *hook_raw_fptr() |
|---|
| 7 | { |
|---|
| 8 | return (void*)0x34C50; |
|---|
| 9 | } |
|---|
| 10 | |
|---|
| 11 | void *hook_raw_ret_addr() |
|---|
| 12 | { |
|---|
| 13 | return (void*)0xFFCC7FF0; |
|---|
| 14 | } |
|---|
| 15 | */ |
|---|
| 16 | |
|---|
| 17 | char *hook_raw_image_addr() |
|---|
| 18 | { |
|---|
| 19 | return (char*)0x105B8AC0; // OK (find on ".crw") |
|---|
| 20 | |
|---|
| 21 | } |
|---|
| 22 | |
|---|
| 23 | long hook_raw_size() |
|---|
| 24 | { |
|---|
| 25 | return 0x75A8F0; // OK (find on ".crw") |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | /* |
|---|
| 29 | void *vid_get_viewport_live_fb() |
|---|
| 30 | { |
|---|
| 31 | return (void*)0; |
|---|
| 32 | } |
|---|
| 33 | */ |
|---|
| 34 | |
|---|
| 35 | void *vid_get_bitmap_fb() |
|---|
| 36 | { |
|---|
| 37 | return (void*)0x103C79A0; // OK (find in _CreatePhysicalVram) |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | void *vid_get_viewport_fb() |
|---|
| 41 | { |
|---|
| 42 | return (void*)0x105F17A0; // OK (find on "VRAM Address : %p") |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | void *vid_get_viewport_fb_d() |
|---|
| 46 | { |
|---|
| 47 | // from ewavr |
|---|
| 48 | int x=(*(int*)0x63AD0); // found in sub_FFD25770 |
|---|
| 49 | return (void *)x; |
|---|
| 50 | // if we start camera in PB mode with movie on display, this pointer will be NULL |
|---|
| 51 | // _fb isn't valid data, but at least it doesn't crash |
|---|
| 52 | // return (void*) (x ? (void *)x : vid_get_viewport_fb()) ; |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | int vid_get_viewport_width_proper() { |
|---|
| 56 | // fake 1:1 mode |
|---|
| 57 | if((mode_get()&MODE_SHOOTING_MASK) == MODE_PORTRAIT) { |
|---|
| 58 | return 528; |
|---|
| 59 | } |
|---|
| 60 | return ((mode_get()&MODE_MASK) == MODE_PLAY)?704:*(int*)0x32C68; |
|---|
| 61 | } |
|---|
| 62 | int vid_get_viewport_width() { |
|---|
| 63 | return vid_get_viewport_width_proper()/2; |
|---|
| 64 | } |
|---|
| 65 | |
|---|
| 66 | int vid_get_viewport_height_proper() { |
|---|
| 67 | // fake 16:9 mode |
|---|
| 68 | if((mode_get()&MODE_SHOOTING_MASK) == MODE_LANDSCAPE) { |
|---|
| 69 | return 180; |
|---|
| 70 | } |
|---|
| 71 | return ((mode_get()&MODE_MASK) == MODE_PLAY)?240:*(int*)(0x32C68+4); |
|---|
| 72 | } |
|---|
| 73 | |
|---|
| 74 | long vid_get_viewport_height() { |
|---|
| 75 | return vid_get_viewport_height_proper(); |
|---|
| 76 | } |
|---|
| 77 | |
|---|
| 78 | int review_fullscreen_mode(){ //from 710 added |
|---|
| 79 | char r; |
|---|
| 80 | get_parameter_data(53, &r, 1); |
|---|
| 81 | return r==0; |
|---|
| 82 | } |
|---|
| 83 | |
|---|
| 84 | int postreview_fullscreen_mode(){ //from 710 added |
|---|
| 85 | char r; |
|---|
| 86 | get_parameter_data(54, &r, 1); |
|---|
| 87 | return r==0; |
|---|
| 88 | } |
|---|
| 89 | |
|---|
| 90 | |
|---|
| 91 | static int file_size_table[3][5]={{3110,2562,1666,1057,288}, |
|---|
| 92 | {1954,1441, 928, 608,176}, |
|---|
| 93 | {960, 736, 480, 320,112}}; // in KB // from 710 added |
|---|
| 94 | |
|---|
| 95 | |
|---|
| 96 | long raw_shoot_avail(){ // from 710 added |
|---|
| 97 | long jpegs,size,quality; |
|---|
| 98 | jpegs=atoi((char*)0x6E8D0); // orig.0x7BD98 find -> a9999 |
|---|
| 99 | get_property_case(23, (void *)&quality, 4); |
|---|
| 100 | get_property_case(24, (void *)&size, 4); |
|---|
| 101 | if ((size>4) || (quality>2)) return 0; |
|---|
| 102 | return (file_size_table[quality][size]*jpegs)/(file_size_table[quality][size]+(hook_raw_size()>>10)); |
|---|
| 103 | } |
|---|
| 104 | |
|---|
| 105 | |
|---|
| 106 | int mf_slider_active() // from 710 added |
|---|
| 107 | { |
|---|
| 108 | return *(long*)0x6C8B0==0x100; // orig.0x798F0 found in "ControlSwitcher.c" |
|---|
| 109 | } |
|---|
| 110 | |
|---|
| 111 | void *vid_get_viewport_live_fb() // from 710 added |
|---|
| 112 | { |
|---|
| 113 | // return (void*)0x10670ee0; |
|---|
| 114 | void **fb=(void **)0x5288; |
|---|
| 115 | unsigned char buff = *((unsigned char*)0x5298); |
|---|
| 116 | if (buff == 0) { |
|---|
| 117 | buff = 2; |
|---|
| 118 | } |
|---|
| 119 | else { |
|---|
| 120 | buff--; |
|---|
| 121 | } |
|---|
| 122 | return fb[buff]; |
|---|
| 123 | } |
|---|
| 124 | |
|---|
| 125 | |
|---|
| 126 | char *camera_jpeg_count_str() |
|---|
| 127 | { |
|---|
| 128 | return (char*)0x6E8D0 ; // from 700 added orig. 0x78688 |
|---|
| 129 | } |
|---|
| 130 | |
|---|
| 131 | // PTP display stuff |
|---|
| 132 | int vid_get_palette_type() { return 1; } |
|---|
| 133 | int vid_get_palette_size() { return 16*4; } |
|---|
| 134 | |
|---|
| 135 | void *vid_get_bitmap_active_palette() { |
|---|
| 136 | return (void *)0x634E0; // GetPaletteFromPhysicalScreen |
|---|
| 137 | } |
|---|
| 138 | |
|---|
| 139 | void *vid_get_bitmap_active_buffer() |
|---|
| 140 | { |
|---|
| 141 | return (void*)(*(int*)0x5ED0); // FFD23420 DisplayPhysicalScreenWithYUVPalette |
|---|
| 142 | } |
|---|
| 143 | |
|---|
| 144 | int vid_get_viewport_fullscreen_height() { |
|---|
| 145 | // except for stitch, always full screen |
|---|
| 146 | // TODO mode may not update at exactly the same time as width and height variables for stitch |
|---|
| 147 | int m = mode_get(); |
|---|
| 148 | if((m&MODE_MASK) != MODE_PLAY && ((m&MODE_SHOOTING_MASK) == MODE_STITCH || (m&MODE_SHOOTING_MASK) == MODE_LANDSCAPE)) { |
|---|
| 149 | return 240; |
|---|
| 150 | } |
|---|
| 151 | return vid_get_viewport_height_proper(); |
|---|
| 152 | } |
|---|
| 153 | int vid_get_viewport_fullscreen_width() { |
|---|
| 154 | // except for stitch, always full screen |
|---|
| 155 | // TODO mode may not update at exactly the same time as width and height variables for stitch |
|---|
| 156 | int m = mode_get(); |
|---|
| 157 | if((m&MODE_MASK) != MODE_PLAY && ((m&MODE_SHOOTING_MASK) == MODE_STITCH || (m&MODE_SHOOTING_MASK) == MODE_PORTRAIT)) { |
|---|
| 158 | return 704; |
|---|
| 159 | } |
|---|
| 160 | return vid_get_viewport_width_proper(); |
|---|
| 161 | } |
|---|
| 162 | |
|---|
| 163 | int vid_get_viewport_display_xoffset() { |
|---|
| 164 | int val=0; |
|---|
| 165 | int m = mode_get(); |
|---|
| 166 | if((m&MODE_MASK) != MODE_PLAY && (m&MODE_SHOOTING_MASK) == MODE_STITCH) { |
|---|
| 167 | short dir=0; |
|---|
| 168 | short seq=0; |
|---|
| 169 | get_property_case(PROPCASE_STITCH_DIRECTION,&dir,sizeof(dir)); |
|---|
| 170 | get_property_case(PROPCASE_STITCH_SEQUENCE,&seq,sizeof(seq)); |
|---|
| 171 | // overall stitch window is 3/4 screen width, centered |
|---|
| 172 | // live part is 1/2, so margin is either 1/8th or 3/8th |
|---|
| 173 | if(dir==0) { |
|---|
| 174 | val = seq?132:44; |
|---|
| 175 | } else { |
|---|
| 176 | val = seq?44:132; |
|---|
| 177 | } |
|---|
| 178 | } else if((m&MODE_SHOOTING_MASK) == MODE_PORTRAIT) { |
|---|
| 179 | val = 44; |
|---|
| 180 | } |
|---|
| 181 | return val; |
|---|
| 182 | } |
|---|
| 183 | |
|---|
| 184 | int vid_get_viewport_xoffset() { |
|---|
| 185 | if((mode_get()&MODE_SHOOTING_MASK) == MODE_PORTRAIT) { |
|---|
| 186 | return 44; |
|---|
| 187 | } |
|---|
| 188 | return 0; |
|---|
| 189 | } |
|---|
| 190 | |
|---|
| 191 | int vid_get_viewport_display_yoffset() { |
|---|
| 192 | int m = mode_get(); |
|---|
| 193 | if((m&MODE_SHOOTING_MASK) == MODE_LANDSCAPE) { |
|---|
| 194 | return 30; |
|---|
| 195 | } |
|---|
| 196 | return ((m&MODE_MASK) != MODE_PLAY && (m&MODE_SHOOTING_MASK) == MODE_STITCH)?60:0; // window is 120, centered in 240 screen |
|---|
| 197 | } |
|---|
| 198 | |
|---|
| 199 | int vid_get_viewport_yoffset() { |
|---|
| 200 | if((mode_get()&MODE_SHOOTING_MASK) == MODE_LANDSCAPE) { |
|---|
| 201 | return 30; |
|---|
| 202 | } |
|---|
| 203 | return 0; |
|---|
| 204 | } |
|---|