Luig Posted October 7, 2010 Share Posted October 7, 2010 (edited) Ok I want to translate: #define get_reg_offset(opcode) (chip8_regs.alg+(opcode>>8)) #define get_reg_value(opcode) (*get_reg_offset(opcode)) To Au3. So far I got: Func get_reg_offset($opcode) Return DllStructGetData($chip_regs, 'alg') + BitShift($opcode, 8)) EndFunc Func get_reg_value($opcode) Return ptr(get_reg_offset($opcode)) EndFunc I know I am missing something because how do I read the value since ptr only makes a pointer. How do I then read the value from the pointer? Edited October 7, 2010 by Luig Link to comment Share on other sites More sharing options...
jaberwacky Posted October 7, 2010 Share Posted October 7, 2010 I'm no C expert by any means but is that a function pointer? Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Sirmabus Posted October 31, 2010 Share Posted October 31, 2010 Something to do with http://www.rockbox.org? Yea you have to define what those things are ("get_reg_offset()" and "chip8_regs.alg") before someone can help you. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 31, 2010 Moderators Share Posted October 31, 2010 No idea what .alg type is, but I might try something like this: Func get_reg_value($opcode) ; assuming get_reg_offset is a mem address Local $talgval = DllStructCreate("long", Ptr(get_reg_offset($opcode)) Return DllStructGetData($talgval, 1) EndFunc Without ptr() might work as well, no idea really without playing with the code myself. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now