How to use Propcases? - page 2 - General Discussion and Assistance - CHDK Forum  

How to use Propcases?

  • 13 Replies
  • 3400 Views
*

Offline reyalp

  • ******
  • 14082
Re: How to use Propcases?
« Reply #10 on: 14 / September / 2023, 18:11:59 »
Advertisements
Quote
The number should be the number of the line with the problem.
Yeah, line 6 in a 2 line script.  :lol
FWIW, that can happen if the file is not actually in plain ASCII text format.

Quote
Yeah, but they all are preset functions. If I try changing them beyond anything, don't they just fail to work, since CHDK functions are designed to only output specific values? So for example, if set_mode(1) is video mode, set_mode(2) is auto mode, and set_mode(3) is sports mode, if there is a certain hidden mode, if I use set_mode(4), it won't actually trigger that mode since CHDK doesn't have that value to inject into the camera, right?
First, there is no set_mode. If you mean set_capture_mode, then yes, only values known to be valid on your camera (which might included undocumented modes if they are known to work) will do anything, because that function works with CHDK generic values that need to be mapped to camera-specific Canon values, and the mapping is defined per-port based (in theory) on the ones that are known to work. However, CHDK also provides set_capture_mode_canon which accepts arbitrary values in the native numbering system.

In any case, it's extremely unlikely that any Canon modes not identified in stubs_entry.S will do anything, aside from possibly crashing.

Quote
For example, these Unused Paint Jobs were found by me, because when I extracted the ASSETS.DAT data file, which contained the game data files, there was a txt file which was by the devs that signified that there was supposed to be an Enamel paint job type, which isn't in the game, and I found it, among another two paint types which aren't even documented.
Well then, firmware reverse engineering is conceptually the same thing, you look for clues and try stuff. You won't find text files, but there are a lot of debug messages and known function names (see the funcs_by_name.csv in the platform / sub directory of your port). However, aside from guessing what eventprocs might do based on name, you generally need to be able to understand firmware code a bit do much useful. Even for eventprocs, it's very helpful to be able to look at the code to get an idea of what kind of parameters they expect and confirm they actually might do something like the name suggests.

Quote
Is there a chance I can brick my camera by directly writing to the addresses?
Short answer: Yes, there's a chance.
Longer answer: You'd have to be pretty determined or very unlucky to brick your camera with poke, but we can't promise you won't damage your camera. Your odds of avoiding damage are better if your experiments are informed by analyzing the firmware, rather than blindly trying stuff.

Quote
Is there perhaps a tutorial where I can see how to do this?
Not really. You need a working knowledge of CHDK, the camera firmware and the related programming and reverse engineering concepts, and after that, you don't need a tutorial ;)

Quote
Is there actual information for the S3IS addresses for all the things CHDK uses? I mean, CHDK itself needs to know which address to write where when I override the shutter speed, or ISO, or Aperture. set_capture_mode() is a function if I understand correctly that CHDK uses to inject a custom value into the memory address of the camera to do this.
As Blackhole said, the functions CHDK uses are in the CHDK source, mostly in the stubs_entry.S and stubs_entry_2.s files for your port. Note most CHDK functionality involves setting propcases or calling firmware functions rather than directly writing memory, although that's also done in a few cases. The Canon firmware is quite complicated, it's rare for significant functionality to be controlled by a single variable.

Quote
If I could emulate the S3IS firmware on my computer, like what I do with the PS2 games, I could use Cheat Engine, see which address changes when a certain mode is changed, and directly write to it, and then when I know what to write where, I'd be able to use Poke, and simply write to that address, however, it seems you need to know how the firmware itself works before doing anything.
It is actually possible to run Canon firmware for some cameras in an emulator, but the current code does not support S3IS, so you'd have to implement that first, which is a significant reverse engineering + coding project in it's own right. In any case, it doesn't help much with shooting-related code, since emulating all the hardware would be very difficult.

Quote
If only these sprites were of any use. :)
The icons being present doesn't mean the functionality is present. Those particular icons may also be used in review mode when a file matches relevant naming convention or has corresponding exif fields.
Don't forget what the H stands for.

Re: How to use Propcases?
« Reply #11 on: 15 / September / 2023, 00:06:36 »
Thanks. I decided to try to set the canon modes instead of just mode, but whenever I just blindly set numbers, it crashed. So I decided to open the S3IS firmware in a Hex Editor and look for clues.

You wouldn't believe what I found at addresses 0x00277B98 and 0x00279FDC. I found 160x120 and 1024x768. I think these are hidden video resolution modes.




In some other addresses I found modes such as Underwater, RAW, Kids & Pets, Fast Frame Rate, High Resolution, and Digital Macro.






Does this mean the S3IS has hidden modes? Does this mean that it's possible to film videos at a higher resolution? Is there perhaps a way I can engage them from this information? Or do I need to know some other stuff? I apologize about asking so many questions. I just can't find this information anywhere.

*

Offline blackhole

  • *****
  • 940
  • A590IS 101b
    • Planetary astrophotography
Re: How to use Propcases?
« Reply #12 on: 15 / September / 2023, 03:55:45 »
You wouldn't believe what I found at addresses 0x00277B98 and 0x00279FDC. I found 160x120 and 1024x768. I think these are hidden video resolution modes.

Does this mean the S3IS has hidden modes? Does this mean that it's possible to film videos at a higher resolution? Is there perhaps a way I can engage them from this information? Or do I need to know some other stuff? I apologize about asking so many questions. I just can't find this information anywhere.
No, it's just strings.
If you look at what is at that address in the firmware, you will see that there is probably no function related to recording video on your camera.
Large parts of the firmware are generic and are used on many camera models, so you may see strings that are not related to your camera.
BTW 0x00277B98 is not an address in the firmware, it is an offset from the starting address. The starting address for your camera is 0xff810000, so the address you need is 0xff810000 + 0x00277B98.
Here's how you can analyze firmware using the free Ghidra app:
https://chdk.fandom.com/wiki/Firmware_analysis_with_Ghidra

Re: How to use Propcases?
« Reply #13 on: 18 / September / 2023, 20:29:10 »
Yeah there was nothing there... Thanks for the info...


 

Related Topics