root/platform/s80/sub/100g/lib.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. hook_raw_image_addr
  2. vid_get_viewport_live_fb
  3. vid_get_bitmap_fb
  4. vid_get_viewport_fb
  5. vid_get_viewport_fb_d
  6. vid_get_viewport_width_proper
  7. vid_get_viewport_height_proper
  8. camera_jpeg_count_str
  9. vid_get_bitmap_active_palette
  10. vid_get_bitmap_active_buffer
  11. _MoveFocusLensToDistance

   1 #include "platform.h"
   2 #include "lolevel.h"
   3 #include "debug_led.h"
   4 
   5 char *hook_raw_image_addr()
   6 {
   7     return (char*)0x1056B960;       // aA08x_crw, followed sd30
   8 }
   9 
  10 void *vid_get_viewport_live_fb()
  11 {
  12 /*
  13 0x5364: 0x105f2c4c: 1st regular buffer
  14 0x5368: 0x1067262c: 2nd regular buffer
  15 0x536c: 0x106f200c: 3rd regular buffer
  16 0x5370: 0x1055ae4c: used when half-shooting, otherwise one of the play mode buffers
  17 0x5374: 0x107719ec: 1st HD movie buffer (1024x768, Y411) OR the "MF point zoom" buffers (triple, 360x120)
  18 0x5378: 0x108919ec: 2nd
  19 */
  20        void **fb=(void **)0x5364; //@FF8AB03C
  21        unsigned char buff = *((unsigned char*)0x537c); //@FF8AB010
  22        if (buff == 0) {
  23            buff = 2;
  24        }
  25        else {
  26            buff--;
  27        }
  28        return fb[buff];
  29 }
  30 
  31 void *vid_get_bitmap_fb()
  32 {
  33    return (void*)0x103C79A0;        // seems to be the same as a620 and sd30
  34 }
  35 
  36 void *vid_get_viewport_fb()
  37 {
  38     return (void*) 0x105F2C4C;  //s80
  39 }
  40 
  41 void *vid_get_viewport_fb_d()
  42 {
  43     return (void*)(*(int*)0x72fdc); //s80
  44 }
  45 
  46 int vid_get_viewport_width_proper() {
  47     int m = mode_get();
  48     if((m&MODE_MASK) == MODE_PLAY) {
  49         return 720; //no tv-out
  50     }
  51     // return hard coded width since mode doesn't update at the same time as GetVRAMHPixelsSize
  52     if((m&MODE_SHOOTING_MASK) == MODE_STITCH) {
  53         return 360;
  54     }
  55     return *(int*)0x36630; // hopefully
  56 }
  57 
  58 int vid_get_viewport_height_proper() {
  59     int m = mode_get();
  60     if((m&MODE_MASK) == MODE_PLAY) {
  61         return 240; //no tv-out
  62     }
  63     // return hard coded width since mode doesn't update at the same time as GetVRAMHPixelsSize
  64     if((m&MODE_SHOOTING_MASK) == MODE_STITCH) {
  65         return 120; 
  66     }
  67     return *(int*)0x36634; // hopefully
  68 }
  69 
  70 char *camera_jpeg_count_str()
  71 {
  72     return (char*)0x81c70;
  73 }
  74 
  75 void *vid_get_bitmap_active_palette() {
  76     return (void *)0x72cf8; // GetPaletteFromPhysicalScreen
  77 }
  78 
  79 void *vid_get_bitmap_active_buffer()
  80 {
  81     return (void*)(*(int*)0x6adc); // @FF92A7D0 DisplayPhysicalScreenWithYUVPalette
  82 }
  83 
  84 volatile char* bitmap_buffer[2] = { (char*)0x103c79a0,  (char*)(0x103c79a0 + 0x15180) };
  85 
  86 
  87 extern void _orig_MoveFocusLensToDistance(short *dist);
  88 
  89 void _MoveFocusLensToDistance(short *dist)
  90 {
  91 /*
  92     Any use of the original MoveFocusLensToDistance fails with an assert due to a "speed limit" check.
  93     However, with disabled check, the use of MoveFocusLensToDistance seems to cause 
  94     focus miscalibration (when used in AF and MF), which only goes away with power cycling...
  95 */
  96     int shmode, afl;
  97     _GetPropertyCase(PROPCASE_SHOOTING_MODE, &shmode, 4);
  98     _GetPropertyCase(PROPCASE_AF_LOCK, &afl, 4);
  99     if (shmode == 19) // MODE_VIDEO_STD
 100     {
 101         if (get_movie_status() != 4) return; // only allow during recording when in movie mode
 102     }
 103     else if (!afl) // if not movie mode, AFL has to be active
 104     {
 105         return;
 106     }
 107     int speedlimitflag = *(int*)0xb23c;
 108     *(int*)0xb23c = 0;
 109     _orig_MoveFocusLensToDistance(dist);
 110     *(int*)0xb23c = speedlimitflag;
 111 }

/* [<][>][^][v][top][bottom][index][help] */