Addin manager: need to manipulate RAM & SMEM
12 posts
• Page 1 of 2 • 1, 2
Addin manager: need to manipulate RAM & SMEM
Hi,
I am planning to release an addin manager. Features will be :
- Shuffle addins
- Change addin icon, name, version, and appname
For shuffling addins, according to https://bible.planet-casio.com/simlo/ch ... cy_RAM.HTM the addin array is at 0x88006D9C. Theoretically all I would have to do is some memcpy. However, is the ram location the same with every OS? If not, is there a reliable way to know the location of the addin array (some syscall)?
For changing the addin icon, name, version and appname (name = displayed name in the system app, appname = beginning with an '@' and used for folders) I would have to write and read at the specific offset (for example: addin appname is at offset 0x20, so I would only modify the 8 bytes at 0x20, without loading the whole addin into ram). The Bfile_ReadFile and Bfile_WriteFile sdk functions seem to do what I want, but is the pointer in the addin array the same pointer that is expected by these functions (the "HANDLE")?
Also, does the appname spans 8 or 9 bytes (including the '@', excluding the '\0')?
I am planning to release an addin manager. Features will be :
- Shuffle addins
- Change addin icon, name, version, and appname
For shuffling addins, according to https://bible.planet-casio.com/simlo/ch ... cy_RAM.HTM the addin array is at 0x88006D9C. Theoretically all I would have to do is some memcpy. However, is the ram location the same with every OS? If not, is there a reliable way to know the location of the addin array (some syscall)?
For changing the addin icon, name, version and appname (name = displayed name in the system app, appname = beginning with an '@' and used for folders) I would have to write and read at the specific offset (for example: addin appname is at offset 0x20, so I would only modify the 8 bytes at 0x20, without loading the whole addin into ram). The Bfile_ReadFile and Bfile_WriteFile sdk functions seem to do what I want, but is the pointer in the addin array the same pointer that is expected by these functions (the "HANDLE")?
Also, does the appname spans 8 or 9 bytes (including the '@', excluding the '\0')?
- SimonLothar
- Senior Member
-
- 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: Addin manager: need to manipulate RAM & SMEM
The start address of the addin array is OS dependent, indeed. You can use the following code to retrieve it. I am not sure, whether it is possible to shuffle the addin array elements. The system registers the available addins every now and then, building the addin array anew.Zezombye wrote:For shuffling addins, according to https://bible.planet-casio.com/simlo/ch ... cy_RAM.HTM the addin array is at 0x88006D9C. Theoretically all I would have to do is some memcpy. However, is the ram location the same with every OS? If not, is there a reliable way to know the location of the addin array (some syscall)?
The syscall:
0x000E: int App_GetAddinEstripInformation( int addinno, int estripno, TAddinEstripInformation*result );
code: Show
I'll be back!
- SimonLothar
- Senior Member
-
- 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: Addin manager: need to manipulate RAM & SMEM
8 bytes. Also refer to http://casiopeia.net/forum/viewtopic.php?f=21&t=1774Zezombye wrote:Also, does the appname spans 8 or 9 bytes (including the '@', excluding the '\0')?
I'll be back!
- SimonLothar
- Senior Member
-
- 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: Addin manager: need to manipulate RAM & SMEM
It is not possible to overwrite existing data with Bfile_WriteFile, if 0->1 bit transitions are involved. You have to create a file of a fitting size and copy the changed data. In case of an addin, this file must not be the running addin, because the addin is executed directly from SMEM.Zezombye wrote:For changing the addin icon, name, version and appname (name = displayed name in the system app, appname = beginning with an '@' and used for folders) I would have to write and read at the specific offset (for example: addin appname is at offset 0x20, so I would only modify the 8 bytes at 0x20, without loading the whole addin into ram). The Bfile_ReadFile and Bfile_WriteFile sdk functions seem to do what I want, but is the pointer in the addin array the same pointer that is expected by these functions (the "HANDLE")?
I'll be back!
Re: Addin manager: need to manipulate RAM & SMEM
That's all I needed to know - thanks!
Another thing I'd like to do is change the OS icons, and perhaps other things like character bitmaps, main menu banner or extinction screen. Would it be possible securely (don't want to brick any calc)?
The way I'd do it is:
Basically iterate over the OS to see if a region matches the bitmap.
However how would I know the OS start and size?
Another thing I'd like to do is change the OS icons, and perhaps other things like character bitmaps, main menu banner or extinction screen. Would it be possible securely (don't want to brick any calc)?
The way I'd do it is:
- Code: Select all
char bitmap[] = {...}
int bitmapSize = //size in bytes
int i;
for (i = OS_START; i <= OS_START + OS_SIZE - bitmapSize; i++) {
int regionMatchesBitmap = TRUE;
for (int j = 0; j < bitmapSize; j++) {
if (bitmap[j] != *((*int)i)) {
regionMatchesBitmap = FALSE;
break;
}
}
if (regionMatchesBitmap) break;
}
//i is now the location of the bitmap in the OS
Basically iterate over the OS to see if a region matches the bitmap.
However how would I know the OS start and size?
Re: Addin manager: need to manipulate RAM & SMEM
After some testing I've encountered a problem with the storage memory.
I manage to get the addin array start and print the name of the addin (from the addin array). However:
- Going to the pointer (addin_start + 8) seems to be 2 addins over (if I try to locate the first addin and read its name, it instead reads the name of the 3rd addin). Trying to access the pointer of another addin yields a system error (for example, if I do addin_start - 4 or + 20). I don't know why it behaves like that
However the syscall GetAddinHeaderAddr seems to work.
- I can't write in the RAM at all, it seems. Trying to modify the name of an addin, internal name (in the addin array) or swapping their position doesn't do anything. Do addins not have write access to RAM/SMEM by absolute adresses? How would I bypass this?
I manage to get the addin array start and print the name of the addin (from the addin array). However:
- Going to the pointer (addin_start + 8) seems to be 2 addins over (if I try to locate the first addin and read its name, it instead reads the name of the 3rd addin). Trying to access the pointer of another addin yields a system error (for example, if I do addin_start - 4 or + 20). I don't know why it behaves like that

- I can't write in the RAM at all, it seems. Trying to modify the name of an addin, internal name (in the addin array) or swapping their position doesn't do anything. Do addins not have write access to RAM/SMEM by absolute adresses? How would I bypass this?
- SimonLothar
- Senior Member
-
- 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: Addin manager: need to manipulate RAM & SMEM
It would be best to post the part of the source, which probably malfunctions.
I'll be back!
- SimonLothar
- Senior Member
-
- 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: Addin manager: need to manipulate RAM & SMEM
The menu-icon of an addin is stored in the G1A-file. The other icons are stored inside the OS. So if you want to change them, you'd have to change the OS.Zezombye wrote:Another thing I'd like to do is change the OS icons, and perhaps other things like character bitmaps, main menu banner or extinction screen. Would it be possible securely (don't want to brick any calc)?
I'll be back!
Re: Addin manager: need to manipulate RAM & SMEM
Here is the complete code:
I know, but is there a way to overwrite the OS? I could do that securely by iterating over the OS until I match a bitmap (I could match some code that happens to match the bitmap, but is it unlikely?), however how would I know the start and size of the OS? Do I need to recalculate checksums?
If I manage to overwrite the OS I will probably also add support to change other things (extinction image, menu banner, character bitmaps, language strings...)
Code: Show
The menu-icon of an addin is stored in the G1A-file. The other icons are stored inside the OS. So if you want to change them, you'd have to change the OS.
I know, but is there a way to overwrite the OS? I could do that securely by iterating over the OS until I match a bitmap (I could match some code that happens to match the bitmap, but is it unlikely?), however how would I know the start and size of the OS? Do I need to recalculate checksums?
If I manage to overwrite the OS I will probably also add support to change other things (extinction image, menu banner, character bitmaps, language strings...)
- SimonLothar
- Senior Member
-
- 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: Addin manager: need to manipulate RAM & SMEM
You declared addinArray as int*. A pointer is incremented by the size of the type it points to. addinArray+12 would increment the pointer by 12 int-sizes, t. i. 48. I think (char*)addinArray+12 should work. Or (TAddinArrayItem*)addinArray+1.Zezombye wrote:Here is the complete code:...
I'll be back!
12 posts
• Page 1 of 2 • 1, 2
Return to Calculator Hacking/Modding Discussions
Who is online
Users browsing this forum: No registered users and 15 guests