melonDS-emu / melonDS

DS emulator, sorta
https://melonds.kuribo64.net
GNU General Public License v3.0
3.21k stars 531 forks source link

Tony Hawk's Motion (USA) missing motion pak #74

Open benderscruffy opened 7 years ago

benderscruffy commented 7 years ago

cannot play the game as it is mising the motion pak tony hawk s motion usa -0

xperia64 commented 4 years ago

The Motion Pack used in this game contains a Kionix 3-axis accelerometer, and an ATTiny13 MCU.

For the following, I will be calling the VDD35 pin of the GBA slot Pin 1, and GND Pin 32:

The protocol used by the ATTiny13 is a simple 17-state loop, where each state is responsible for outputting 2 bits:

To convert an input acceleration in g's to the 8-bit units of this pack, use the following equation: output_accel = min(0xFE, max(0, int((input_accel 0.660V/g+1.65V) 256 / 3.3V))) These values were obtained from the datasheets of the chips.

The output on each accelerometer axis must be clamped between 0x0 and 0xFE inclusive, as 0xFF is likely reserved for synchronization.