Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Fruithapje21 authored Jul 1, 2023
1 parent 07ebde4 commit 1c43cc4
Showing 1 changed file with 123 additions and 50 deletions.
173 changes: 123 additions & 50 deletions src/pchtxtCreator.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,25 @@ def float2hex(f):


versions = ['1.0.0', '1.1.0', '1.1.1', '1.1.2']
data = [['082CE09B06E33A123CB1E2770F5F9147709033DB', '0377AC54', '01968C2C'],
['D5AD6AC71EF53E3E52417C1B81DBC9B4142AA3B3', '0381B344', '019C2260'],
['168DD518D925C7A327677286E72FEDA833314919', '0382413C', '019C013C'],
['9A10ED9435C06733DA597D8094D9000AB5D3EE60', '03813D0C', '019B5480']]

for ii in range(len(versions)):
with open(args.output_dir + '\\' + f'main-{versions[ii]}.pchtxt', 'w') as f:
f.write(f'@nsobid-{data[ii][0]}\n\n')
f.write('@flag print_values\n')
f.write('@flag offset_shift 0x100\n\n')
f.write('@enabled\n')
f.write(f'{data[ii][1]} {float2hex(ratio)}\n')
f.write(f'{data[ii][2]} {val2asm(ratio)}\n')
f.write('@stop\n')

for version in versions:
with open(args.output_dir + '\\' + f'main-{version}.pchtxt', 'w') as f:

if versions[ii] == '1.0.0':
f.write('\n')
if version == '1.0.0':
content = f"""
@nsobid-082CE09B06E33A123CB1E2770F5F9147709033DB
@flag print_values
@flag offset_shift 0x100
@enabled
0377AC54 {float2hex(ratio)}
01968C2C {val2asm(ratio)}
@stop
// Scaling factor
@enabled
03774580 {float2hex(scaling_factor)}
037745a0 {float2hex(scaling_factor)}
@stop
// NPC Marker Fix
Expand All @@ -86,7 +84,7 @@ def float2hex(f):
03774500 A01B40BD // ldr s0, [x29,#0x18]
03774504 E0C31FF8 // stur x0, [sp, #-4]
03774508 00000090 // adrp x0, #0
0377450c 018045BD // ldr s1, [x0, #0x580]
0377450c 01A045BD // ldr s1, [x0, #0x5a0]
03774510 E0C35FF8 // ldur x0, [sp, #-4]
03774514 0008211E // fmul s0, s0, s1
03774518 A11F40BD // ldr s1, [x29, #0x1c]
Expand All @@ -99,7 +97,7 @@ def float2hex(f):
03774520 802240BD // ldr s0, [x20, #0x20]
03774524 E0C31FF8 // stur x0, [sp, #-4]
03774528 00000090 // adrp x0, #0
0377452c 018045BD // ldr s1, [x0, #0x580]
0377452c 01A045BD // ldr s1, [x0, #0x5a0]
03774530 E0C35FF8 // ldur x0, [sp, #-4]
03774534 0008211E // fmul s0, s0, s1
03774538 812640BD // ldr s1, [x20, #0x24]
Expand All @@ -112,7 +110,7 @@ def float2hex(f):
03774540 E00B40BD // ldr s0, [sp, #0x8]
03774544 E0C31FF8 // stur x0, [sp, #-4]
03774548 00000090 // adrp x0, #0
0377454c 018045BD // ldr s1, [x0, #0x580]
0377454c 01A045BD // ldr s1, [x0, #0x5a0]
03774550 E0C35FF8 // ldur x0, [sp, #-4]
03774554 0008211E // fmul s0, s0, s1
03774558 E10F40BD // ldr s1, [sp, #0xc]
Expand All @@ -125,23 +123,44 @@ def float2hex(f):
03774560 000140BD // ldr s0, [x8]
03774564 E0C31FF8 // stur x0, [sp, #-4]
03774568 00000090 // adrp x0, #0
0377456c 018045BD // ldr s1, [x0, #0x580]
0377456c 01A045BD // ldr s1, [x0, #0x5a0]
03774570 E0C35FF8 // ldur x0, [sp, #-4]
03774574 0008211E // fmul s0, s0, s1
03774578 010540BD // ldr s1, [x8, #0x4]
0377457c C0035FD6 // ret
@stop
// Enemy Notice Fix
@enabled
012ae24c CD189394 // bl #0x24C6334
03774580 000140BD // ldr s0, [x8]
03774584 E0C31FF8 // stur x0, [sp, #-4]
03774588 00000090 // adrp x0, #0
0377458c 01A045BD // ldr s1, [x0, #0x5a0]
03774590 E0C35FF8 // ldur x0, [sp, #-4]
03774594 0008211E // fmul s0, s0, s1
03774598 010540BD // ldr s1, [x8, #0x4]
0377459c C0035FD6 // ret
@stop
"""
content_trimmed = trim(content)
f.write(content_trimmed)
f.write('\n')

if versions[ii] == '1.1.0':
f.write('\n')

if version == '1.1.0':
content = f"""
@nsobid-D5AD6AC71EF53E3E52417C1B81DBC9B4142AA3B3
@flag print_values
@flag offset_shift 0x100
@enabled
0381B344 {float2hex(ratio)}
019C2260 {val2asm(ratio)}
@stop
// Scaling factor
@enabled
036d1100 {float2hex(scaling_factor)}
036d1120 {float2hex(scaling_factor)}
@stop
// NPC Marker Fix
Expand All @@ -150,7 +169,7 @@ def float2hex(f):
036d1080 A01B40BD // ldr s0, [x29,#0x18]
036d1084 E0C31FF8 // stur x0, [sp, #-4]
036d1088 00000090 // adrp x0, #0
036d108c 010041BD // ldr s1, [x0, #0x100]
036d108c 012041BD // ldr s1, [x0, #0x120]
036d1090 E0C35FF8 // ldur x0, [sp, #-4]
036d1094 0008211E // fmul s0, s0, s1
036d1098 A11F40BD // ldr s1, [x29, #0x1c]
Expand All @@ -163,7 +182,7 @@ def float2hex(f):
036d10a0 802240BD // ldr s0, [x20, #0x20]
036d10a4 E0C31FF8 // stur x0, [sp, #-4]
036d10a8 00000090 // adrp x0, #0
036d10ac 010041BD // ldr s1, [x0, #0x100]
036d10ac 012041BD // ldr s1, [x0, #0x120]
036d10b0 E0C35FF8 // ldur x0, [sp, #-4]
036d10b4 0008211E // fmul s0, s0, s1
036d10b8 812640BD // ldr s1, [x20, #0x24]
Expand All @@ -176,7 +195,7 @@ def float2hex(f):
036d10c0 E10B40BD // ldr s1, [sp, #0x8]
036d10c4 E0C31FF8 // stur x0, [sp, #-4]
036d10c8 00000090 // adrp x0, #0
036d10cc 000041BD // ldr s0, [x0, #0x100]
036d10cc 002041BD // ldr s0, [x0, #0x120]
036d10d0 E0C35FF8 // ldur x0, [sp, #-4]
036d10d4 2108201E // fmul s1, s1, s0
036d10d8 E00F40BD // ldr s0, [sp, #0xc]
Expand All @@ -189,23 +208,44 @@ def float2hex(f):
036d10e0 000140BD // ldr s0, [x8]
036d10e4 E0C31FF8 // stur x0, [sp, #-4]
036d10e8 00000090 // adrp x0, #0
036d10ec 010041BD // ldr s1, [x0, #0x100]
036d10ec 012041BD // ldr s1, [x0, #0x120]
036d10f0 E0C35FF8 // ldur x0, [sp, #-4]
036d10f4 0008211E // fmul s0, s0, s1
036d10f8 010540BD // ldr s1, [x8, #0x4]
036d10fc C0035FD6 // ret
@stop
// Enemy Notice Fix
@enabled
012e5e68 A6AC8F94 // bl #0x23EB298
036d1100 000140BD // ldr s0, [x8]
036d1104 E0C31FF8 // stur x0, [sp, #-4]
036d1108 00000090 // adrp x0, #0
036d110c 012041BD // ldr s1, [x0, #0x120]
036d1110 E0C35FF8 // ldur x0, [sp, #-4]
036d1114 0008211E // fmul s0, s0, s1
036d1118 010540BD // ldr s1, [x8, #0x4]
036d111c C0035FD6 // ret
@stop
"""
content_trimmed = trim(content)
f.write(content_trimmed)
f.write('\n')

if versions[ii] == '1.1.1':
f.write('\n')

if version == '1.1.1':
content = f"""
@nsobid-168DD518D925C7A327677286E72FEDA833314919
@flag print_values
@flag offset_shift 0x100
@enabled
0382413C {float2hex(ratio)}
019C013C {val2asm(ratio)}
@stop
// Scaling factor
@enabled
036d9f60 {float2hex(scaling_factor)}
036d9f80 {float2hex(scaling_factor)}
@stop
// NPC Marker Fix
Expand All @@ -214,7 +254,7 @@ def float2hex(f):
036d9ee0 A01B40BD // ldr s0, [x29,#0x18]
036d9ee4 E0C31FF8 // stur x0, [sp, #-4]
036d9ee8 00000090 // adrp x0, #0
036d9eec 01604FBD // ldr s1, [x0, #0xf60]
036d9eec 01804FBD // ldr s1, [x0, #0xf80]
036d9ef0 E0C35FF8 // ldur x0, [sp, #-4]
036d9ef4 0008211E // fmul s0, s0, s1
036d9ef8 A11F40BD // ldr s1, [x29, #0x1c]
Expand All @@ -227,7 +267,7 @@ def float2hex(f):
036d9f00 802240BD // ldr s0, [x20, #0x20]
036d9f04 E0C31FF8 // stur x0, [sp, #-4]
036d9f08 00000090 // adrp x0, #0
036d9f0c 01604FBD // ldr s1, [x0, #0xf60]
036d9f0c 01804FBD // ldr s1, [x0, #0xf80]
036d9f10 E0C35FF8 // ldur x0, [sp, #-4]
036d9f14 0008211E // fmul s0, s0, s1
036d9f18 812640BD // ldr s1, [x20, #0x24]
Expand All @@ -240,7 +280,7 @@ def float2hex(f):
036d9f20 E10B40BD // ldr s1, [sp, #0x8]
036d9f24 E0C31FF8 // stur x0, [sp, #-4]
036d9f28 00000090 // adrp x0, #0
036d9f2c 00604FBD // ldr s0, [x0, #0xf60]
036d9f2c 00804FBD // ldr s0, [x0, #0xf80]
036d9f30 E0C35FF8 // ldur x0, [sp, #-4]
036d9f34 2108201E // fmul s1, s1, s0
036d9f38 E00F40BD // ldr s0, [sp, #0xc]
Expand All @@ -253,23 +293,44 @@ def float2hex(f):
036d9f40 000140BD // ldr s0, [x8]
036d9f44 E0C31FF8 // stur x0, [sp, #-4]
036d9f48 00000090 // adrp x0, #0
036d9f4c 01604FBD // ldr s1, [x0, #0xf60]
036d9f4c 01804FBD // lldr s1, [x0, #0xf80]
036d9f50 E0C35FF8 // ldur x0, [sp, #-4]
036d9f54 0008211E // fmul s0, s0, s1
036d9f58 010540BD // ldr s1, [x8, #0x4]
036d9f5c C0035FD6 // ret
@stop
// Enemy Notice Fix
@enabled
012e39fc 59D98F94 // bl #0x23F6564
036d9f60 000140BD // ldr s0, [x8]
036d9f64 E0C31FF8 // stur x0, [sp, #-4]
036d9f68 00000090 // adrp x0, #0
036d9f6c 01804FBD // ldr s1, [x0, #0xf80]
036d9f70 E0C35FF8 // ldur x0, [sp, #-4]
036d9f74 0008211E // fmul s0, s0, s1
036d9f78 010540BD // ldr s1, [x8, #0x4]
036d9f7c C0035FD6 // ret
@stop
"""
content_trimmed = trim(content)
f.write(content_trimmed)
f.write('\n')

if versions[ii] == '1.1.2':
f.write('\n')
if version == '1.1.2':
content = f"""
@nsobid-9A10ED9435C06733DA597D8094D9000AB5D3EE60
@flag print_values
@flag offset_shift 0x100
@enabled
03813D0C {float2hex(ratio)}
019B5480 {val2asm(ratio)}
@stop
// Scaling factor
@enabled
036c9b00 {float2hex(scaling_factor)}
036c9b20 {float2hex(scaling_factor)}
@stop
// NPC Marker Fix
Expand All @@ -278,7 +339,7 @@ def float2hex(f):
036c9a80 A01B40BD // ldr s0, [x29,#0x18]
036c9a84 E0C31FF8 // stur x0, [sp, #-4]
036c9a88 00000090 // adrp x0, #0
036c9a8c 01004BBD // ldr s1, [x0, #0xb00]
036c9a8c 01204BBD // ldr s1, [x0, #0xb20]
036c9a90 E0C35FF8 // ldur x0, [sp, #-4]
036c9a94 0008211E // fmul s0, s0, s1
036c9a98 A11F40BD // ldr s1, [x29, #0x1c]
Expand All @@ -291,7 +352,7 @@ def float2hex(f):
036c9aa0 802240BD // ldr s0, [x20, #0x20]
036c9aa4 E0C31FF8 // stur x0, [sp, #-4]
036c9aa8 00000090 // adrp x0, #0
036c9aac 01004BBD // ldr s1, [x0, #0xb00]
036c9aac 01204BBD // ldr s1, [x0, #0xb20]
036c9ab0 E0C35FF8 // ldur x0, [sp, #-4]
036c9ab4 0008211E // fmul s0, s0, s1
036c9ab8 812640BD // ldr s1, [x20, #0x24]
Expand All @@ -304,7 +365,7 @@ def float2hex(f):
036c9ac0 E10B40BD // ldr s1, [sp, #0x8]
036c9ac4 E0C31FF8 // stur x0, [sp, #-4]
036c9ac8 00000090 // adrp x0, #0
036c9acc 00004BBD // ldr s0, [x0, #0xb00]
036c9acc 00204BBD // ldr s0, [x0, #0xb20]
036c9ad0 E0C35FF8 // ldur x0, [sp, #-4]
036c9ad4 2108201E // fmul s1, s1, s0
036c9ad8 E00F40BD // ldr s0, [sp, #0xc]
Expand All @@ -317,16 +378,28 @@ def float2hex(f):
036c9ae0 000140BD // ldr s0, [x8]
036c9ae4 E0C31FF8 // stur x0, [sp, #-4]
036c9ae8 00000090 // adrp x0, #0
036c9aec 01004BBD // ldr s1, [x0, #0xb00]
036c9aec 01204BBD // ldr s1, [x0, #0xb20]
036c9af0 E0C35FF8 // ldur x0, [sp, #-4]
036c9af4 0008211E // fmul s0, s0, s1
036c9af8 010540BD // ldr s1, [x8, #0x4]
036c9afc C0035FD6 // ret
@stop
// Enemy Notice Fix
@enabled
012C2828 B61C9094 // bl #0x24072D8
036c9b00 000140BD // ldr s0, [x8]
036c9b04 E0C31FF8 // stur x0, [sp, #-4]
036c9b08 00000090 // adrp x0, #0
036c9b0c 01204BBD // ldr s1, [x0, #0xb20]
036c9b10 E0C35FF8 // ldur x0, [sp, #-4]
036c9b14 0008211E // fmul s0, s0, s1
036c9b18 010540BD // ldr s1, [x8, #0x4]
036c9b1c C0035FD6 // ret
@stop
"""
content_trimmed = trim(content)
f.write(content_trimmed)
f.write('\n')

f.write('\n@fruithapje21')

f.write('\n\n@fruithapje21')

0 comments on commit 1c43cc4

Please sign in to comment.