[casetta] Extract Program names and data from backups

[ Thread Index | Date Index | More lists.tuxfamily.org/casetta Archives ]


First of all, yes I think some programs names are not followed by 5 0x00 characters, or in can't use an hex editor :-).If you don't want to loose your time with checking, see attachments for a screenshot where you can see that(casio-names.png).
Thanks for your backups, they helped :-)

How program data is stored in raw backups:

Program names are composed of one to eight numbers/letters characters (and some other accepted characters "+","-", etc...).
If the length of the program name is inferior to eight, remaining space is filled by 0xff characters.
After the name of the program, you have 5 random characters (most of the time 0x00 characters).
After these 5 characters, you have 2 characters, which reprent the address of the beginning of the program.
In fact, they are reversed. For example, if you have 0xfe and 0xf7, the real adress of the beginning of the program is 0xf7fe.
See casio-names.png for an example.(Can I add this information in the formats wiki ?)

See backup-prgm-extractor.py for the code. There are 2 functions, the first function takes a raw backup and returns a
list of tuples with the name and the reversed address of the program. The second functions takes a raw backup and a reversed adress (under the form of a string of 2 hex characters, as it is returned by the first function) and returns a raw cafix program.
I didn't put this code in any of casetta files, because I didn't know where !!!

About the future of casetta_gtk, you mockups look good to me : it will be easier for """"newbies"""" to understand how casetta_gtk
works and make functions easier to access (for example we will not have to right click anymore to create a new program).
I have an idea about how to include my backup extractor in casetta_gtk. See casetta-ext0.png and casetta-ext1.png

PS : I couldn't get your sodoku solver (the first) work on my caculator... Is it normal ? I got a math error!
Can I keep your DERIVEES program ? (You see that my functions are working, I was able to extract these 2 programs :-)
Fabien ANDRE aka Xion345
Linux User #418689 -- fabien.andre.g@xxxxxxxxxx -- xion345@xxxxxxxxxxxxx
Which mindset is right? Mine, of course. People who disagree with me are by definition crazy. (Until I change my mind, when they can suddenly become upstanding citizens. I'm flexible, and not black-and-white.) ( Linus Torvalds, Not dated )

PNG image

PNG image

PNG image

# -*- coding: utf-8 -*-

import re

def find_prgmNames(rawback):
    names_pattern = re.compile( """
    [\x00\xee]          # first character (0x00 except if the last prgm have a     
                        # password. In this case, 0xee)
    \x99\xa9\xb9\xcd\xce\x89\x20]  # A program name begins by a charater         
    {7})                # End of program name: 7 of the above charaters or 0xff 
    .{5}                # 5 charaters
    (.{2})              # offset of the beginning of the prgm data 
    """, re.VERBOSE)
    for i in names_list :
        i[0]=i[0].replace('\xff', '')
    return nlist

def find_prgmData(ad, rawback):
    print h1
    print h2
    ad2=int(h1+h2.replace('0x',''), 16)
    print ad2
    while i > 0:
        prgm_data += (rawback[i])
        if rawback[i] == '\xff':
        i -= 1
    return prgm_data
if __name__=="__main__":
    filename=raw_input('Enter the name of a cafix raw backup : ')
    print "\n".join(i[0]+str('-')+str(names.index(i)) for i in names)
    num=input('Enter the number of the program you want to extract : ')
    filename=raw_input('Enter the name of the file you want your \
    extracted program to be saved in (prog-yourprogname.cafix): ')
    ext_prog=find_prgmData(names[num][1], back)
    file=open(filename, 'w')

Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/