Coding Questions and other Quandaries
My Sims Sky Heroes (U) Wii

Infinite Health (All Modes)

C34221F8 00000005
3D609196 616B5C50
7C0B9000 40A20010
3D808000 3979FFD1
916C03E4 B3320000
60000000 00000000
C2BDC8D0 00000007
D01F0010 3D608000
818B03E8 2C0C0000
398C0001 918B03E8
40A20008 93EB03E0
812B03E4 7C0C4800
41A00008 39800000
918B03E8 00000000
040003EC 42C80000
C2BDCE3C 00000004
3D608000 818B03E0
7C0CF800 40A20008
C00B03EC D01F0010
60000000 00000000


Serious use of EVA for pointer and conditionals for a code that works in all gameplay modes without giving the AI infinite health also.

[Insert/Original Code]

0x814221F8 sth r25, 0(r18)  #ASM This is storing the # of AI selected in the match option screen

[Insert]

loc_0x0:
  lis r11, 0x9196                  #ASM Load upper half-word of address # of AI stored at          
  ori r11, r11, 0x5C50          #ASM Load lower half-word of address # of AI stored at 
  cmpw r11, r18                  #ASM Check that it is only writing # of AI address
  bne+ default_code            #ASM If not equal, AI # not being written to
  lis r12, 0x8000                  #ASM If equal, load upper half-word of EVA address
  subi r11, r25, 0x2F            #ASM Subtract 0x2F from r25 for 4 bit value that equals P1 + number of AI selected
                                           The values in r25 is in this format: 0x0033 = 3 AI, 0x0035 = 5 AI etc...
                                           Subtracting 0x2F from r25 leaves me with 4 bit representation of P1 + AI Qty.
                                           The reason I did this is for use in another insert to follow.
                                            

stw r11, 0x3E4(r12)             #ASM Store value of P1 + number of AI at EVA 0x800003E4; this is used in a conditional, 
                                              in the following insert below.

default_code:                  
  sth r25, 0(r18)                  #ASM Default AI quantity select store



[Insert/Original Code]

0x80BDC8D0 stfs f0, 0x10 (r31) #ASM Stores beginning health value to P1 and AI; Code is executed (# of AI + 1 for P1) times.
                                                P1 health value is always the first to be stored Yay!!!.

[Insert]

loc_0x0:
  stfs f0, 0x10(r31)        #ASM Default code; Stores beginning health value to P1 and AI
  lis r11, 0x8000            #ASM Load upper half-word of EVA address
  lwz r12, 0x3E8(r11)     #ASM Load write cycle counter from EVA
  cmpwi r12, 0x0            #ASM See if it is the first write
  addi r12, r12, 0x1        #ASM Increment write cycle counter
  stw r12, 0x3E8(r11)     #ASM Store updated value back to EVA
  bne+ not_me              #ASM If not the first cycle don't write health value address to EVA
  stw r31, 0x3E0(r11)     #ASM If 1st write cycle, store P1 Health address in EVA

not_me:
  lwz r9, 0x3E4(r11)       #ASM Load r9 with (# of AI + 1 for P1) in EVA
  cmpw r12, r9              #ASM Compare with write cycle counter in r12
  blt+ store_it               #ASM If less than, store updated write cycle count 
  li r12, 0x0                   #ASM if (# of AI + 1 for P1) equals write cycle counter 
                                   #Reset write cycle counter for next dogfight, race or story mode level 
store_it:
  stw r12, 0x3E8(r11)    #ASM Store updated write cycle count in EVA


The portion that gives P1 infinite health:

[Insert/Original Code]

0x80BDCE3C stfs f0, 16(r31) #ASM Stores decreased health value after damage

[Before Insert]

040003EC 42C80000   #ASM Write full health floating point value in EVA

[Insert]

loc_0x0:
  lis r11, 0x8000         #ASM Load upper half-word of EVA address
  lwz r12, 0x3E0(r11)  #ASM Load health address pointer in EVA
  cmpw r12, r31          #ASM Compare with address in r31 
  bne+ store_it           #ASM If not equal, it's not P1. 
  lfs f0, 1004(r11)       #ASM If equal it is P1. Grab full Health value from EVA

store_it:
  stfs f0, 16(r31)         #ASM Default code. Store it.
Reply


Messages In This Thread
RE: Coding Questions and other Quandaries - by Hackwiz - 07-05-2022, 11:39 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)