| 557 | } |
| 558 | |
| 559 | int FCEUI_DecodePAR(const char *str, int *a, int *v, int *c, int *type) |
| 560 | { |
| 561 | unsigned int boo[4]; |
| 562 | if(strlen(str)!=8) return(0); |
| 563 | |
| 564 | sscanf(str,"%02x%02x%02x%02x",boo,boo+1,boo+2,boo+3); |
| 565 | |
| 566 | *c=-1; |
| 567 | |
| 568 | if(1) |
| 569 | { |
| 570 | *a=(boo[3]<<8)|(boo[2]+0x7F); |
| 571 | *v=0; |
| 572 | } |
| 573 | else |
| 574 | { |
| 575 | *v=boo[3]; |
| 576 | *a=boo[2]|(boo[1]<<8); |
| 577 | } |
| 578 | /* Zero-page addressing modes don't go through the normal read/write handlers in FCEU, so |
| 579 | we must do the old hacky method of RAM cheats. |
| 580 | */ |
| 581 | if(*a<0x0100) |
| 582 | *type=0; |
| 583 | else |
| 584 | *type=1; |
| 585 | return(1); |
| 586 | } |
| 587 | |
| 588 | /* name can be NULL if the name isn't going to be changed. */ |
| 589 | /* same goes for a, v, and s(except the values of each one must be <0) */ |