Jump to content

5 posts in this topic

Recommended Posts

Posted (edited)

I am trying to have a hex (edit: int) value entered by the end user into a text box defined by psedittextcell in a referenced plist, to be used as a reference to replace an original hex at a certain predefined offset, looking like this:

Writedata (0xOFFSET, 0x"hex value from text box");

 

I have tried defining a string in advance that extracts the input and formats it as 0x"8 digit hex", as that is what I want the length of the hex to be (4 bytes). I have the following code:

 

NSDictionary *iosgods = [NSDictionary dictionaryWithContentsOfFile:PLIST_PATH];
NSString *ItemID = [NSString stringWithFormat:@"0x%08X",[[iosgods objectForKey:@"kItemID"] intValue]];
writeData(0x377314, ItemID);
 
But this returns an error during compilation saying that the candidate function is not viable, no known conversion from "NSString*" to 'unsigned int' for 2nd argument:
bool writeData (vm_address_t offset, unsigned int data) {
1 error generated.
 
Could anyone shed some light on what I am doing wrongly? Thank you in advance!
Updated by de2ndlaw
Posted

This is because writedata is not setup to convert strings to hex.

 

I see. In that case, could you please suggest a way for me to go about doing this? I have also tried 

 

writeData(0x377314, [iosgods objectForKey:@"kItemID"] intValue]);

 

And entered an integer inside instead, but the app crashes, and I believe this is because the hex was not properly formatted into 16 bit little endian, which is what I would like it to be.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines