Register

Cannot create MCS file other than basic program & function

Discuss issues related to Calculator Hacking/Modding.
Junior Member
Posts: 9
Joined: Sun Aug 21, 2016 10:33 am
Calculators: None

Cannot create MCS file other than basic program & function

Postby Zezombye » Sun Aug 21, 2016 11:02 am

Hi,

I am currently trying to create a MCS List file. However it doesn't work at all; it only works with basic programs (DirType 0x01) and functions (0x02). Creating a file with another DirType doesn't work, and seems to only work with functions.

The code I am using is:

Code: Select all
int AddIn_main(int isAppli, unsigned short OptionNum) {
    //These are the bytes of an actual list
   char data[] = {0xAA, 0xAC, 0xBD, 0xAF, 0x90, 0x88, 0x9A, 0x8D, 0xCE, 0xFF, 0xEF, 0xFF, 0xEF, 0xFF, 0x32, 0xFE, 0xFF, 0xFF, 0xFF, 0x73, 0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x4C, 0x49, 0x53, 0x54, 0x20, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x6D, 0x61, 0x69, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x31, 0x4C, 0x49, 0x53, 0x54, 0x32, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x09, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x4E, 0x00, 0x48, 0x80, 0x2E, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x17, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x52, 0x01};

   result = MCS_PutInternalItem(0x05, "LIST 2", 0x8C, data);
   //result = MCS_DeleteInternalItem(0x05, "LIST 2");
    GetKey(&key);
   return 1;
}


Here are my findings:
- Putting a number between 1 and 20 as the file name (instead of "LIST 2") will create it as a function, and the file "Y=DATA" will show up in the file explorer. This happens even when the DirType is not 0x02 (except if it is 0x01, in this case it shows up in the PROGRAM folder).
- Not putting a number as the file name does create the file (launching the addin again throws "item already exists" error), however it doesn't show up in the explorer.
- The DirType doesn't seem to influence where the file is created: doing MCS_PutInternalItem(0x05, "LIST 2", 0x8C, data) then MCS_PutInternalItem(0x06, "LIST 2", 0x8C, data) will throw an "item already exists" error, even though the DirTypes are different. However, after executing MCS_PutInternalItem(0x06, "LIST 2", 0x8C, data) then MCS_DeleteInternalItem(0x05, "LIST 2") will throw "dir doesn't exist" (it works fine if I were to put 0x06 as the DirType).

I am completely stuck at this point, it seems I can only create files as functions and basic programs (and possibly captures, but I haven't tested yet). Any idea?

Senior Member
User avatar
Posts: 605
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Re: Cannot create MCS file other than basic program & functi

Postby SimonLothar » Sun Aug 21, 2016 1:16 pm

I am not sure if I got your problem correctly, but to directly write a list into main memory, the following code works well
char data[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x03, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

};

result = MCS_DeleteInternalItem( 5, "1LIST2" );
result = MCS_PutInternalItem( 5, "1LIST2", sizeof( data ), data );

It creates a list, which f. i. shows up as List 2, when you open STAT.
The example above represents a List { 1, 2, 3 }.
0x00, 0x03: Count of list items
0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00: Item in the calculators 12-byte BCD-format

The external G1M-format differs from the internal MCS-format.
I'll be back!

Junior Member
Posts: 9
Joined: Sun Aug 21, 2016 10:33 am
Calculators: None

Re: Cannot create MCS file other than basic program & functi

Postby Zezombye » Sun Aug 21, 2016 1:35 pm

Oh, so the file name is MCS_ITEMNAME, and not the name displayed in the file explorer. Good to know. Also, in a more general way, is the internal MCS-format the G1M-format without the header and sub-headers?

It works fine now, thanks a lot :D

Senior Member
User avatar
Posts: 605
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Re: Cannot create MCS file other than basic program & functi

Postby SimonLothar » Sun Aug 21, 2016 1:54 pm

Zezombye wrote:...in a more general way, is the internal MCS-format the G1M-format without the header and sub-headers?
I suppose so.
I'll be back!

Return to Calculator Hacking/Modding Discussions

Who is online

Users browsing this forum: No registered users and 55 guests