Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function round(num, numDecimalPlaces)
- local mult = 10^(numDecimalPlaces or 0)
- return math.floor(num * mult + 0.5) / mult
- end
- function printMemoryDomains(x,y)
- local list = {}
- list = memory.getmemorydomainlist()
- local curr = memory.getcurrentmemorydomain()
- local num = table.getn(list)
- local i
- gui.text(x,y,"Current: " .. curr)
- for i=0,num do
- gui.text(x,y + 15*(i+1),list[i])
- end
- end
- function printLocation(x,y)
- --0x7BABC related to movement startup
- XSpeed = memory.readfloat(0x7BAE4, true, "RDRAM")
- YSpeed = memory.readfloat(0x7BAEC, true, "RDRAM")
- Speed = math.sqrt(XSpeed * XSpeed + YSpeed * YSpeed)
- gui.text(x,y + 0,"X: " .. round(memory.readfloat(0x7BACC, true, "RDRAM"),4))
- gui.text(x,y+15,"Y: " .. round(memory.readfloat(0x7BAD4, true, "RDRAM"),4))
- gui.text(x,y+30,"XSpeed: " .. round(XSpeed,4))
- gui.text(x,y+45,"YSpeed: " .. round(YSpeed,4))
- gui.text(x,y+60,"Speed: " .. round(Speed,4))
- end
- --84EE6 and 84EEE strongly related to "area/zone or maybe music"
- --memory.write_u16_be(0x084EE6, 2, "RDRAM")
- --memory.write_u16_be(0x084EEE, 2, "RDRAM")
- --memory.write_u16_be(0x08536A, 2, "RDRAM")
- function printItems(x,y)
- for i=1,30 do
- Item = memory.readbyte(0x8CF78 + (i -1), "RDRAM")
- if Item ~= 255 and Item <= 25 then
- gui.text(x,y + 15*(i-1), "Item:" .. globalItemList[Item+1])
- end
- end
- end
- function printAgility (x,y)
- --gui.text(x,y + 15*0,"Agi(?): " .. round(memory.readfloat(0x7BC14, true, "RDRAM"),4))
- --gui.text(x+200,y + 15*0,"/800")
- gui.text(x,y + 15*1,"AgiField: " .. round(memory.readfloat(0x7BC18, true, "RDRAM"),4))
- gui.text(x+200,y + 15*1,"/1000")
- gui.text(x,y+15*2,"AgiTown: " .. round(memory.readfloat(0x7BC1C, true, "RDRAM"),4))
- gui.text(x+200,y + 15*2,"/2000")
- gui.text(x,y+15*3,"AgiBattle:" .. round(memory.readfloat(0x7BCA0, true, "RDRAM"),4))
- gui.text(x+200,y + 15*3,"/50")
- gui.text(x,y+15*4,"MPRecharge: " .. round(memory.readfloat(0x7BC0C, true, "RDRAM"),4))
- gui.text(x+200,y + 15*4,"/35")
- --gui.text(x,y+15*3,"Camera: " .. round(memory.readfloat(0x85D3C, true, "RDRAM"),4))
- --gui.text(x,y+15*4,"Camera: " .. round(memory.readfloat(0x85DAC, true, "RDRAM"),4))
- --gui.text(x,y+15*5,"Camera: " .. round(memory.readfloat(0x85DE4, true, "RDRAM"),4))
- --gui.text(x,y+15*6,"Camera: " .. round(memory.readfloat(0x85E54, true, "RDRAM"),4))
- gui.text(x,y+15*7,"BattleLastX: " .. round(memory.readfloat(0x86B18, true, "RDRAM"),4))
- --gui.text(x,y+15*8,"BattleLastZ: " .. round(memory.readfloat(0x86B1C, true, "RDRAM"),4))
- gui.text(x,y+15*8,"BattleLastY: " .. round(memory.readfloat(0x86B20, true, "RDRAM"),4))
- gui.text(x,y+15*9,"CameraCenteredHereX: " .. round(memory.readfloat(0x86DD8, true, "RDRAM"),4))
- --gui.text(x,y+15*9,"CameraCenteredHereZ: " .. round(memory.readfloat(0x86DDC, true, "RDRAM"),4))
- gui.text(x,y+15*10,"CameraCenteredHereY: " .. round(memory.readfloat(0x86DE0, true, "RDRAM"),4))
- --gui.text(x,y+15*9,"ArenaX: " .. round(memory.readfloat(0x88188, true, "RDRAM"),4))
- --gui.text(x,y+15*10,"ArenaX: " .. round(memory.readfloat(0x881B8, true, "RDRAM"),4))
- --gui.text(x,y+15*11,"ArenaX: " .. round(memory.readfloat(0x8C5A4, true, "RDRAM"),4))
- end
- function printEncounterCounter(x,y)
- gui.text(x,y,"EncCount: " .. memory.read_u16_be(0x8C578, "RDRAM"))
- --You can cheese 1.9 pixels as it rolls over.
- gui.text(x+190,y,"/2000")
- gui.text(x,y + 15,"Increment: " .. round(memory.readfloat(0x8C574, true, "RDRAM"),4))
- RNG_EC = memory.read_u32_be(0x4D748, "RDRAM")
- gui.text(x,y + 30, "RNG: " .. RNG_EC .. " = " .. string.format("%08X ", RNG_EC))
- gui.text(x,y + 45, "A: " .. memory.read_u16_be(0x22FE2, "RDRAM"))
- gui.text(x,y + 60, "B: " .. memory.read_u16_be(0x22FE4, "RDRAM") - 1000)
- gui.text(x,y + 75, "C: " .. memory.read_u16_be(0x22FE6, "RDRAM"))
- end
- function freezeEncounterCounter()
- memory.write_u16_be(0x8C578, 0, "RDRAM")
- memory.writefloat(0x8C574, 0, true, "RDRAM")
- end
- function highEncounterCounter()
- memory.write_u16_be(0x8C578, 1800,"RDRAM")
- end
- function printEnemyStats(x,y)
- EnemiesLeft = memory.readbyte(0x07C993, "RDRAM")
- TimeUntilYouAct = memory.read_u16_be(0x07C99A, "RDRAM")
- gui.text(x,y,"ToAct:" .. TimeUntilYouAct)
- NumEnemies = EnemiesLeft -- For Now, Not Ideal
- if NumEnemies > 0 then
- for i=1,NumEnemies do
- Base = 0x07C99C --next = 0x07CAC4
- WalkDec1 = memory.read_u16_be(0x07C99C + 296*(i-1), "RDRAM")
- RelatedToAttacking = memory.read_u16_be(0x07C99E + 296*(i-1), "RDRAM")
- RelatedToAttacking2 = memory.read_u16_be(0x07C9A0 + 296*(i-1), "RDRAM")
- FloatSomething = memory.readfloat(0x7C9A8 + 296*(i-1), true, "RDRAM")
- CurrHP = memory.read_u16_be(0x07C9A2 + 296*(i-1), "RDRAM") --9A2 and ACA and BF2 --7C993 = dead? 3 = alive, 2 = dead? (296 = 0x128)
- MaxHP = memory.read_u16_be(0x07C9A4 + 296*(i-1), "RDRAM")
- X = memory.readfloat(0x7C9BC + 296*(i-1), true, "RDRAM")
- Z = memory.readfloat(0x7C9C0 + 296*(i-1), true, "RDRAM")
- Y = memory.readfloat(0x7C9C4 + 296*(i-1), true, "RDRAM")
- RapidlyChanging1 = memory.read_u16_be(0x07C9C6 + 296*(i-1), "RDRAM")
- RapidlyChanging2 = memory.read_u16_be(0x07C9D4 + 296*(i-1), "RDRAM")
- RapidlyChanging3 = memory.read_u16_be(0x07C9D6 + 296*(i-1), "RDRAM")
- RapidlyChanging4 = memory.read_u16_be(0x07C9DC + 296*(i-1), "RDRAM")
- RapidlyChanging5 = memory.read_u16_be(0x07C9DE + 296*(i-1), "RDRAM")
- SizeModifier = memory.readfloat(0x7C9E0 + 296*(i-1), true, "RDRAM")
- --memory.writefloat(0x7C9E0, 0.4, true, "RDRAM") -- Meme Address
- TrueSize = memory.readfloat(0x7C9E4 + 296*(i-1), true, "RDRAM")
- Float3 = memory.readfloat(0x7C9E8 + 296*(i-1), true, "RDRAM")
- Float4 = memory.readfloat(0x7C9EC + 296*(i-1), true, "RDRAM")
- Float5 = memory.readfloat(0x7C9F0 + 296*(i-1), true, "RDRAM")
- --Hell Hound: Anything below 20.9 distance from center to center."
- --Were Hare less than 15.6 hits. Difference of 5.3
- --Hell Hound sphere of influence is about 27.0
- -- 0.084
- -- 130
- -- 130 * 0.084 = 10.92
- -- -1.428
- -- 1
- -- 120
- -- 0.07
- -- 80
- -- 80 * 0.07 = 5.6
- -- 0.2275
- -- 1
- -- 120
- ID = memory.readbyte(0x07CA0D + 296*(i-1), "RDRAM") --A0D
- RapidlyChanging6 = memory.read_u16_be(0x07CA10 + 296*(i-1), "RDRAM")
- RapidlyChanging7 = memory.read_u16_be(0x07CA12 + 296*(i-1), "RDRAM")
- RelatedToAttacking3 = memory.readbyte(0x07CA19+ 296*(i-1), "RDRAM")
- Dunno1 = memory.readbyte(0x07CA1B+ 296*(i-1), "RDRAM")
- Atk = memory.read_u16_be(0x07CAAC + 296*(i-1), "RDRAM")
- Agi = memory.read_u16_be(0x07CAAE + 296*(i-1), "RDRAM")
- Def= memory.read_u16_be(0x07CAB0 + 296*(i-1), "RDRAM")
- --Exp does not appear to be here. Total Exp for battle maybe?
- gui.text(x+100*(i-1),y+15,"HP:" .. CurrHP .. "/" .. MaxHP)
- gui.text(x+100*(i-1),y+30,"At:" .. Atk)
- gui.text(x+100*(i-1),y+45,"De:" .. Def)
- gui.text(x+100*(i-1),y+60,"Ag:" .. Agi)
- gui.text(x+100*(i-1),y+75,"ID:" .. ID)
- gui.text(x+100*(i-1),y+90,"WalkDec:" .. WalkDec1)
- gui.text(x+100*(i-1),y+105,"Size:" .. round(SizeModifier*TrueSize,4))
- --gui.text(x+100*(i-1),y+120,"3:" .. Dunno3)
- end
- end
- end
- --Solvaring
- --Zelse
- --Nepty
- --Shilf
- --Fargo
- --Guilty
- --Beigis Stats in ROM at D87944
- --Mammon in ROM at D8797C --Offset is 0x38
- --*
- --*
- --6 areas and bosses
- --
- --0x112664 07D0BF 07D0AF 07D0AE 07D0AD 07D0AA 07D0A9
- --1 96 68 9 39 8 39
- --0 116 112 90 41 89 41
- --255 136 184 144 38 144 38
- --0 156 164 32 40 31 40
- --0 176 192 140 39 140 39
- --39 39 39 39 39 8 144 39 9 68 96 65 141
- --41 41 41 41 41 89 144 41 90 112 116 129 147
- --Were Hare ADC094 80, 140, 0.07
- --Hell Hound 130, 170, 0.084
- --Man Eater 115, 135, 0.084
- --Big Mouth ADC13C 130, 70, 0.105
- --Parassault 90, 150, 0.077
- --Orc Jr 90, 150, 0.077
- --Gremlin 90, 140, 0.084
- --Skeleton 90, 135, 0.084
- --Ghost Hound 90, 238, 0.084
- --Merrow 130, 170, 0.084
- --Wolf Goat 80, 125, 0.084, 130, 170, 0.091
- --*
- --Goblin B6337C
- --Frog King
- --Apophis
- --Mad Doll
- --Death Hugger
- --Kobold
- --Man Trap
- --Bat
- --Frog Knight
- --Marionasty
- --Dark Goblin
- --Hot Lips
- --Ghost Stalker B6361C
- --Treant
- --Cockatrice
- --*
- --Multi-Optics BBDE9C
- --Mimic
- --Crawler
- --Scorpion
- --Scare Crow
- --Wyvern
- --Skelebat
- --Cryshell BBE024
- --Blood Jell
- --Caterpillar (9) -- C7D935 is interesting, may be red herring
- --Fish Man
- --*
- --Sandman (ID 0) C317EC
- --Werecat
- --Nightmare
- --Blue Man
- --Winged Sunfish
- --Gloon Wing
- --Ogre (ID 6)
- --Rocky (ID 7)
- --Red Wyvern
- --FlamedMane
- --Magma Fish
- --RedRose (ID 11)
- --WhiteRoseKnight: C31A8C
- --*
- --Orc C9BE54
- --Ghost C9BE8C
- --Will o Wisp
- --Sprite
- --JackoLantern
- --Arachnoid
- --Lamia
- --Temptress
- --Pixie
- --Grangach
- --Thunder Jell
- --Termant
- --*
- --Judgment HP: CC443C
- --Pin Head HP: CC44AC
- --Pale Rider: CC4474
- --Spriggan: CC44E4
- --RNG ROM
- --023BE2 =16838 and 023BE6 = 20077
- --41C64E6Dh + 3039h
- --12345 or 13345 ??
- --023BE4
- --RNG RAM
- --022FE0
- --memory.write_u16_be(0x22FE2, 0, "RDRAM")
- --memory.write_u16_be(0x22FE4, 300, "RDRAM")
- --memory.write_u16_be(0x22FE6, 0, "RDRAM")
- --Avalanche Y starts at 0x86F2C
- function printStats(x,y)
- local Exp = memory.read_u32_be(0x07BA90, "RDRAM")
- local HPLv = memory.readbyte(0x07BAB0, "RDRAM")
- local MPLv = memory.readbyte(0x07BAB1, "RDRAM")
- local AgiLv = memory.readbyte(0x07BAB2, "RDRAM")
- local DefLv = memory.readbyte(0x07BAB3, "RDRAM")
- local Lv = memory.readbyte(0x07BAB4, "RDRAM")
- local CurrHP = memory.read_u16_be(0x7BA84, "RDRAM")
- local MaxHP = memory.read_u16_be(0x7BA86, "RDRAM")
- local HPSub = memory.readbyte(0x7BAA9, "RDRAM")
- local CurrMP = memory.read_u16_be(0x7BA88, "RDRAM")
- local MaxMP = memory.read_u16_be(0x7BA8A, "RDRAM")
- local MPSub = memory.readbyte(0x7BAAB, "RDRAM")
- local Def = memory.readbyte(0x7BA8F, "RDRAM")
- local DefSub = memory.readbyte(0x7BAAF, "RDRAM")
- local Agi = memory.readbyte(0x7BA8D, "RDRAM")
- local AgiSub = memory.readbyte(0x7BAAD, "RDRAM")
- gui.text(x,y+0,"HP: " .. CurrHP .. "/" .. MaxHP .. " (" .. HPSub .. "/" .. globalStatTable[HPLv+1] ..")")
- gui.text(x,y+15,"MP: " .. CurrMP .. "/" .. MaxMP .. " (" .. MPSub .. "/" .. 4*globalStatTable[MPLv+1] ..")")
- gui.text(x,y+30,"Def: " .. Def .. " (" .. DefSub .. "/" .. 2*globalStatTable[DefLv+1] ..")")
- gui.text(x,y+45,"Agi: " .. Agi .. " (" .. AgiSub .. "/" .. globalStatTable[AgiLv+1] ..")")
- gui.text(x,y+60,"Lv: " .. Lv .. " (" .. Exp .. "/" .. globalLvTable[Lv+1] .. ")")
- end
- function HP50()
- memory.write_u16_be(0x7BA84, 50, "RDRAM")
- end
- function setSpirits(f,e,wa,wi)
- memory.writebyte(0x7BAA4, f, "RDRAM")
- memory.writebyte(0x7BAA5, e, "RDRAM")
- memory.writebyte(0x7BAA6, wa, "RDRAM")
- memory.writebyte(0x7BAA7, wi, "RDRAM")
- end
- function setStats(HP,MP,De,Ag)
- memory.write_u16_be(0x7BA86, HP, "RDRAM")
- memory.write_u16_be(0x7BA8A, MP, "RDRAM")
- memory.writebyte(0x7BA8F, De, "RDRAM")
- memory.writebyte(0x7BA8D, Ag, "RDRAM")
- end
- function stackOfJewelsAndWings()
- --Earth Orb opens Connor Fortress door.
- --Wind Jade opens door to access Blue Cave.
- --Water Jewel reopens ship.
- memory.writebyte(0x8CF78, 20, "RDRAM")
- memory.writebyte(0x8CF79, 21, "RDRAM")
- memory.writebyte(0x8CF7A, 22, "RDRAM")
- memory.writebyte(0x8CF7B, 14, "RDRAM")
- memory.writebyte(0x8CF7C, 15, "RDRAM")
- memory.writebyte(0x8CF7D, 16, "RDRAM")
- memory.writebyte(0x8CF7E, 17, "RDRAM")
- memory.writebyte(0x8CF7F, 18, "RDRAM")
- memory.writebyte(0x8CF80, 19, "RDRAM")
- end
- function setupLvTable(tmpTable)
- --This table is calculated off the current level.
- local i
- for i=1,99 do
- tmpTable[i] = memory.read_u32_be(0x05493C+4*(i-1),"ROM")
- end
- return tmpTable
- end
- function printLvTable(x,y,tmpTable)
- local i
- for i=1,99 do
- gui.text(x,y+i*15,tmpTable[i])
- end
- end
- function setupStatTable(tmpTable1)
- --This table is calculated off the concept of numStatLevels, not current level.
- local i
- for i=1,70 do
- tmpTable1[i] = memory.read_u16_be(0x054ACC+2*(i-1),"ROM")
- end
- return tmpTable1
- end
- function printStatTable(x,y,tmpTable1)
- --ROM 0x054909 is starting stats I think?
- local i
- for i=1,70 do
- gui.text(x,y+i*15,tmpTable1[i])
- end
- end
- function printObjectCoordinates(x,y)
- --memory.writefloat(0x86F2C, 1600, true, "RDRAM")
- BrianX = memory.readfloat(0x7BACC, true, "RDRAM")
- BrianY = memory.readfloat(0x7BAD4, true, "RDRAM")
- i = 1 --Enemy number 1 (starting at 1)
- EnemyX = memory.readfloat(0x7C9BC + 296*(i-1), true, "RDRAM")
- EnemyY = memory.readfloat(0x7C9C4 + 296*(i-1), true, "RDRAM")
- for i=1,10 do
- --memory.writefloat(0x86F24 + 60*(i-1), -20, true, "RDRAM") --X
- --memory.writefloat(0x86F2C + 60*(i-1), -350, true, "RDRAM") --Y
- --RightSide -1367,930
- --LeftSide -1327, 930
- --BackSide -1347, 948
- --FrontSide -1347, 908
- --Hell Hound: Anything below 20.9 distance from center to center."
- --Were Hare less than 15.6 hits.
- --
- --Solvaring 10 + 8.4 Note: Solvaring is moving about half a pixel during standing.
- --Zelse 10 + 5.6 (Investigate Zelse Mid-Range) Zelse moves about 0.4 pixels during standing. He recoils a couple pixels when hit.
- --Nepty 10 + 4.9 Nepty moves about 0.4 px during standing.
- --Shilf 10 + 4.9 Shilf moves about 0.05
- --Fargo 10 + 7 moves about 0.05
- --Guilty 10 + 9.52 No movement
- --Beigis 10 + 6.3 No movement
- --Mammon 10 + 94.5 Moves around 0.6 px.
- Timer = memory.read_u16_be(0x86F1C + 60*(i-1), "RDRAM")
- X = memory.readfloat(0x86F24 + 60*(i-1), true, "RDRAM")
- Z = memory.readfloat(0x86F28 + 60*(i-1), true, "RDRAM")
- Y = memory.readfloat(0x86F2C + 60*(i-1), true, "RDRAM")
- XDiff= BrianX - X
- YDiff= BrianY - Y
- D = math.sqrt(XDiff*XDiff + YDiff*YDiff)
- A = math.atan2(XDiff,YDiff)*(180/(math.pi))
- EnemyXDiff = EnemyX - X
- EnemyYDiff = EnemyY - Y
- EnemyD = math.sqrt(EnemyXDiff*EnemyXDiff + EnemyYDiff*EnemyYDiff)
- EnemyA = math.atan2(EnemyXDiff,EnemyYDiff)*(180/(math.pi))
- j=0
- if i > 5 then
- j=1
- end
- if (Timer > 0) then
- gui.text(x+140*(i-j*5-1),y+0*15 + j*100,"Timer: " .. Timer)
- gui.text(x+140*(i-j*5-1),y+1*15 + j*100,"X: " .. round(X,3))
- gui.text(x+140*(i-j*5-1),y+2*15 + j*100,"Z: " .. round(Z,3))
- gui.text(x+140*(i-j*5-1),y+3*15 + j*100,"Y: " .. round(Y,3))
- gui.text(x+140*(i-j*5-1),y+4*15 + j*100,"D: " .. round(D,3))
- gui.text(x+140*(i-j*5-1),y+5*15 + j*100,"A: " .. round(A,3)) --16 angles
- --gui.text(x+140*(i-j*5-1),y+4*15 + j*100,"D: " .. round(EnemyD,3))
- --gui.text(x+140*(i-j*5-1),y+5*15 + j*100,"A: " .. round(EnemyA,3))
- end
- end
- --F1C Timer
- --F24 X
- --F28 Z
- --F2C Y
- --F60 X
- --F64 Z
- --F68 Y
- end
- function rocksBrianToEnemy(BrianX1,BrianY1,EnemyX1,EnemyY1,Size1)
- numRocks1 = 0
- --textfile = "BizDump2"
- --dumpfile = textfile..".txt"
- --io.output(dumpfile)
- for i=0,15 do --Angles
- for j=20,39 do --Distances
- thisRockX1= BrianX1 + j*math.cos(i*22.5*math.pi/180)
- thisRockY1= BrianY1 + j*math.sin(i*22.5*math.pi/180)
- XDiff1= thisRockX1 - EnemyX1
- YDiff1= thisRockY1 - EnemyY1
- D1 = math.sqrt(XDiff1*XDiff1 + YDiff1*YDiff1)
- if D1 <= Size1 + 10 then
- numRocks1 = numRocks1 + 1
- --io.write(thisRockX1, " ", thisRockY1, " ", i, " ", j, "\n")
- end
- end
- end
- --io.output():close()
- return numRocks1
- end
- function howManyRocksCurrently(x,y)
- BrianX = memory.readfloat(0x7BACC, true, "RDRAM")
- BrianY = memory.readfloat(0x7BAD4, true, "RDRAM")
- i = 1 --Enemy number 1 (starting at 1)
- EnemyX = memory.readfloat(0x7C9BC + 296*(i-1), true, "RDRAM")
- EnemyY = memory.readfloat(0x7C9C4 + 296*(i-1), true, "RDRAM")
- SizeModifier = memory.readfloat(0x7C9E0 + 296*(i-1), true, "RDRAM")
- TrueSize = memory.readfloat(0x7C9E4 + 296*(i-1), true, "RDRAM")
- Size = SizeModifier*TrueSize
- XDiff= BrianX - EnemyX
- YDiff= BrianY - EnemyY
- D = math.sqrt(XDiff*XDiff + YDiff*YDiff)
- A = math.atan2(XDiff,YDiff)*(180/(math.pi))
- R = rocksBrianToEnemy(BrianX,BrianY,EnemyX,EnemyY,Size)
- gui.text(x,y+15*0,"D: " .. round(D,3))
- gui.text(x,y+15*1,"A: " .. round(A,3))
- gui.text(x,y+15*2,"EnemySize:" .. round(Size,3))
- gui.text(x,y+15*3,"NumRocks:" .. R .. " (0x" .. string.format("%02X", R) .. ") ")
- gui.text(x,y+15*4,"BrianX:" .. round(BrianX,4))
- gui.text(x,y+15*5,"BrianY:" .. round(BrianY,4))
- gui.text(x,y+15*6,"EnemyX:" .. round(EnemyX,4))
- gui.text(x,y+15*7,"EnemyY:" .. round(EnemyY,4))
- end
- function heatMapGenerator()
- MapSize = 120
- BrianX = math.floor(MapSize/2)
- BrianY = math.floor(MapSize/2)
- Size = 6.3
- --Solvaring 10 + 8.4 Note: Solvaring is moving about half a pixel during standing.
- --Zelse 10 + 5.6 (Investigate Zelse Mid-Range) Zelse moves about 0.4 pixels during standing. He recoils a couple pixels when hit.
- --Nepty 10 + 4.9 Nepty moves about 0.4 px during standing.
- --Shilf 10 + 4.9 Shilf moves about 0.05
- --Fargo 10 + 7 moves about 0.05
- --Guilty 10 + 9.52 No movement
- --Beigis 10 + 6.3 No movement
- --Mammon 10 + 94.5 Moves around 0.6 px.
- heatTextfile = "HeatMap"
- heatDumpfile = heatTextfile..".txt"
- io.output(heatDumpfile)
- Max = 0
- for EnemyX=0,MapSize do
- for EnemyY=MapSize,0,-1 do
- R = rocksBrianToEnemy(BrianX,BrianY,EnemyX,EnemyY,Size)
- if R > Max then
- Max = R
- end
- io.write(string.format("%02X ", R))
- end
- io.write("\n")
- end
- io.write("\n")
- io.write("EnemySize: " .. Size)
- io.write("\n")
- io.write("Max: ", string.format("%02X", Max))
- io.write("\n")
- io.write("MapSize: " .. MapSize+1)
- io.output():close()
- end
- globalItemList = {
- "0. Spirit Light",
- "1. Fresh Bread",
- "2. Honey Bread",
- "3. Healing Potion",
- "4 Dragon's Potion",
- "5. Dew Drop",
- "6. Mint Leaves",
- "7. Heroes Drink",
- "8. Silent Flute",
- "9.Celine's Bell",
- "10.Replica",
- "11.Giant's Shoes",
- "12.Silver Amulet",
- "13.Golden Amulet",
- "14.White Wings",
- "15.Yellow Wings",
- "16.Blue Wings",
- "17.Green Wings",
- "18.Red Wings",
- "19.Black Wings",
- "20.Earth Orb",
- "21.Wind Jade",
- "22.Water Jewel",
- "23.Fire Ruby",
- "24.Eletale Book",
- "25.Dark Gaol Key",
- }
- function CalcNextRNG(x,y)
- RNG1 = memory.read_u32_be(0x04D748, "RDRAM")
- Next1RNG = getNextRNG(RNG1)
- Next2RNG = getNextRNG(Next1RNG)
- Next3RNG = getNextRNG(Next2RNG)
- --gui.text(x,y+0,"NextLo: " .. string.format("%08X ",R_LO2))
- --gui.text(x,y+15,"NextHi: " .. string.format("%08X ",R_HI2))
- gui.text(x,y+30,"NextRNG1: " .. string.format("%08X ", Next1RNG))
- gui.text(x,y+45,"NextRNG2: " .. string.format("%08X ", Next2RNG))
- gui.text(x,y+60,"NextRNG3: " .. string.format("%08X ", Next3RNG))
- gui.text(x,y+75,"BufRNG1: " .. string.format("%08X ", BufRNG))
- gui.text(x,y+90,"BufRNG2: " .. string.format("%08X ", BufRNG2))
- gui.text(x,y+105,"BufRNG3: " .. string.format("%08X ", BufRNG3))
- if RNGTableGlobal[1]~= nil then
- for i=1,100 do -- Was 10000
- if RNG1 == RNGTableGlobal[i] then
- gui.text(x,y+120,"RNG Increment: " .. i)
- i = 1000000
- end
- end
- end
- modifier = 1
- if memory.read_u16_be(0x7BD30, "RDRAM")==1 then
- modifier = -1
- end
- Counter1 = modifier * memory.read_u16_be(0x7BD32, "RDRAM")
- if Counter1 ~= 1 then
- Last1 = Counter1
- end
- gui.text(x,y+135,"Counter1: " .. Counter1 .. " " .. Last1)
- modifier = 1
- if memory.read_u16_be(0x7BDB4, "RDRAM")==1 then
- modifier = -1
- end
- Counter2 = modifier * memory.read_u16_be(0x7BDB6, "RDRAM")
- if Counter2 ~= 1 then
- Last2 = Counter2
- end
- gui.text(x,y+150,"Counter2: " .. Counter2 .. " " .. Last2)
- --[[
- modifier = 1
- if memory.read_u16_be(0x7C1B6, "RDRAM")==1 then
- modifier = -1
- end
- Counter6 = modifier * memory.read_u16_be(0x7C1B8, "RDRAM")
- if Counter6 ~= 1 then
- Last6 = Counter6
- end
- gui.text(x,y+165,"Counter6: " .. Counter6 .. " " .. Last6)
- --]]
- modifier = 1
- if memory.read_u16_be(0x7C1D4, "RDRAM")==1 then
- modifier = -1
- end
- Counter3 = modifier * memory.read_u16_be(0x7C1D6, "RDRAM")
- if Counter3 ~= 1 then
- Last3 = Counter3
- end
- gui.text(x,y+180,"Counter3: " .. Counter3 .. " " .. Last3)
- modifier = 1
- if memory.read_u16_be(0x7C258, "RDRAM")==1 then
- modifier = -1
- end
- Counter4 = modifier * memory.read_u16_be(0x7C25A, "RDRAM")
- if Counter4 ~= 1 then
- Last4 = Counter4
- end
- gui.text(x,y+195,"Counter4: " .. Counter4 .. " " .. Last4)
- modifier = 1
- if memory.read_u16_be(0x7C23C, "RDRAM")==1 then
- modifier = -1
- end
- Counter5 = modifier * memory.read_u16_be(0x7C23E, "RDRAM")
- if Counter5 ~= 1 then
- Last5 = Counter5
- end
- gui.text(x,y+210,"Counter5: " .. Counter5 .. " " .. Last5)
- Incrementer = memory.read_u16_be(0x86A1A, "RDRAM")
- if Incrementer > 32768 then
- Incrementer = Incrementer - 65536
- end
- Incrementer = Incrementer - 6
- gui.text(x,y+225,"Increment4: " .. Incrementer) -- see also 7C1D4.
- Incrementer = memory.read_u16_be(0x86A32, "RDRAM")
- if Incrementer > 32768 then
- Incrementer = Incrementer - 65536
- end
- Incrementer = Incrementer - 6
- gui.text(x,y+240,"Increment4: " .. Incrementer) -- see also 7C1D4.
- --memory.write_u16_be(0x86A1A, 3, "RDRAM")
- --memory.write_u16_be(0x86A32, 3, "RDRAM")
- --memory.write_u16_be(0x22FE2, 0, "RDRAM") --41C6 --0 FREEZES RNG
- --memory.write_u16_be(0x22FE4, 2001, "RDRAM")
- --memory.write_u16_be(0x22FE6, 1, "RDRAM") --4E6D --0 FREEZES RNG
- --memory.write_u32_be(0x4D748, 0x00000001, "RDRAM")
- --memory.write_u16_be(0x86A1A, 0, "RDRAM")
- --memory.write_u16_be(0x7BDB6, 10, "RDRAM")
- --memory.write_u16_be(0x7C1D6, 10, "RDRAM")
- if PrevRNG ~= Next1RNG then
- BufRNG3 = PrevRNG3
- BufRNG2 = PrevRNG2
- BufRNG = PrevRNG
- PrevRNG3 = Next3RNG -- This is poorly buffered and doesn't quite work right, basically just a sanity check.
- PrevRNG2 = Next2RNG -- This is poorly buffered and doesn't quite work right, basically just a sanity check.
- PrevRNG = Next1RNG --Lol double buffer
- end
- end
- function getNextRNG(passedRNG)
- A1 = memory.read_u16_be(0x22FE2, "RDRAM")
- B1 = memory.read_u16_be(0x22FE4, "RDRAM") - 1000
- C1 = memory.read_u16_be(0x22FE6, "RDRAM")
- R_HI1 = math.floor(passedRNG/0x10000)
- R_LO1 = passedRNG % 0x10000
- R_HI2 = A1 * R_LO1 + (R_HI1 * C1)
- R_HI2 = R_HI2 % 65536
- R_LO2 = R_LO1 * C1 + B1 --16,16,16
- passedRNG = (65536*R_HI2+R_LO2) % 0x100000000
- return passedRNG
- end
- function generateRNGTable(makeDumpfile)
- RNGTextfile = "RNGDump"
- RNGDumpfile = RNGTextfile..".txt"
- if makeDumpfile then
- io.output(RNGDumpfile)
- startRNGSeed = 2209236614
- ThisR = startRNGSeed
- io.write(ThisR)
- io.write("\n")
- for i=2,10000 do
- ThisR = getNextRNG(ThisR)
- io.write(ThisR)
- io.write("\n")
- end
- io.output():close()
- end
- --Magic Barrier Test Section
- --[[
- NN = 39
- RNGTextfile2 = "RNGDumpNOrdered"
- RNGDumpfile2 = RNGTextfile2..".txt"
- if makeDumpfile then
- io.output(RNGDumpfile2)
- startRNGSeed = 1
- ThisR = startRNGSeed
- for j = 1,NN do
- ThisR = getNextRNG(ThisR)
- end
- AA = ThisR
- for j = 1,NN do
- ThisR = getNextRNG(ThisR)
- end
- BB = ThisR
- if ((math.floor(AA)/65536) % 100) >= 90 and ((math.floor(BB)/65536) % 100) >= 90 then
- io.write("1")
- io.write("\n")
- elseif ((math.floor(AA)/65536) % 100) >= 90 then
- io.write("0")
- io.write("\n")
- end
- --io.write(ThisR)
- --io.write("\n")
- for i=2,10000 do
- ThisR = i
- for j = 1,NN do
- ThisR = getNextRNG(ThisR)
- end
- AA = ThisR
- for j = 1,NN do
- ThisR = getNextRNG(ThisR)
- end
- BB = ThisR
- if ((math.floor(AA)/65536) % 100) >= 90 and ((math.floor(BB)/65536) % 100) >= 90 then
- io.write("1")
- io.write("\n")
- elseif ((math.floor(AA)/65536) % 100) >= 90 then
- io.write("0")
- io.write("\n")
- end
- --io.write(ThisR)
- --io.write("\n")
- end
- io.output():close()
- end
- ]]
- --End Magic Barrier Test Section
- --Make table
- startRNGSeed = 2209236614
- ThisR = startRNGSeed
- RNGTableGlobal[1] = ThisR
- for i=2,10000 do
- ThisR = getNextRNG(ThisR)
- RNGTableGlobal[i] = ThisR
- end
- end
- function avalancheBasher()
- -- Start with a file loaded ready to cast avalanche.
- --=20*(W2/22.5)+(V2-20)+180
- savestate.saveslot(9)
- AvTextfile = "Avalanche Basher"
- AvDumpfile = AvTextfile..".txt"
- io.output(AvDumpfile)
- startRNGSeed = 2209236614
- ThisR = startRNGSeed
- D = 0
- A = 0
- for j=1,20000 do
- savestate.loadslot(9)
- memory.write_u32_be(0x04D748, j, "RDRAM") -- RNG
- emu.frameadvance()
- joypad.set({["A"]=true},1)
- memory.write_u32_be(0x04D748, j, "RDRAM") -- RNG
- emu.frameadvance()
- joypad.set({["A"]=true},1)
- for k=1,36 do
- emu.frameadvance()
- memory.write_u32_be(0x04D748, j, "RDRAM") -- RNG
- gui.text(100,100,"D: " .. round(D,3))
- gui.text(100,115,"A: " .. round(A,3)) --16 angles
- gui.text(100,130,"Iteration: " .. j) --16 angles
- end
- BrianX = memory.readfloat(0x7BACC, true, "RDRAM")
- BrianY = memory.readfloat(0x7BAD4, true, "RDRAM")
- i = 1 --Enemy number 1 (starting at 1)
- EnemyX = memory.readfloat(0x7C9BC + 296*(i-1), true, "RDRAM")
- EnemyY = memory.readfloat(0x7C9C4 + 296*(i-1), true, "RDRAM")
- Timer = memory.read_u16_be(0x86F1C + 60*(i-1), "RDRAM")
- X = memory.readfloat(0x86F24 + 60*(i-1), true, "RDRAM")
- Z = memory.readfloat(0x86F28 + 60*(i-1), true, "RDRAM")
- Y = memory.readfloat(0x86F2C + 60*(i-1), true, "RDRAM")
- XDiff= BrianX - X
- YDiff= BrianY - Y
- D = math.sqrt(XDiff*XDiff + YDiff*YDiff)
- D = round(D,3)
- A = math.atan2(XDiff,YDiff)*(180/(math.pi))
- A = round(A,3)
- EnemyXDiff = EnemyX - X
- EnemyYDiff = EnemyY - Y
- EnemyD = math.sqrt(EnemyXDiff*EnemyXDiff + EnemyYDiff*EnemyYDiff)
- EnemyA = math.atan2(EnemyXDiff,EnemyYDiff)*(180/(math.pi))
- ThisR = getNextRNG(ThisR)
- --=20*(W4/22.5)+(V4-20)+180
- V = 20 * (A/22.5)+(D-20) + 180 --unique Rock ID
- io.write(V)
- io.write("\n")
- end
- io.output():close()
- end
- -- Initializations
- local i
- globalLvTable = {}
- globalLvTable = setupLvTable(globalLvTable)
- globalStatTable = {}
- globalStatTable = setupStatTable(globalStatTable)
- memory.usememorydomain("RDRAM")
- RNGTableGlobal = {}
- ----------------------------
- --Changes go down here.--
- ----------------------------
- local tmp
- --memory.writebyte(0x07BAB4, 10, "RDRAM")
- --HP50()
- --setSpirits(48,48,48,48)
- --setStats(200,100,250,20) -- HP MP De Ag
- --heatMapGenerator()
- makeDumpFile = false
- generateRNGTable(makeDumpFile)
- --avalancheBasher()
- --memory.write_u32_be(0x04D748, 1, "RDRAM") -- RNG
- PrevRNG = 0
- PrevRNG2 = 0
- PrevRNG3 = 0
- BufRNG3 = 0
- BufRNG2 = 0
- BufRNG = 0
- Last1 = 1
- Last2 = 1
- Last3 = 1
- Last4 = 1
- Last5 = 1
- while true do
- --memory.write_u32_be(0x7508C, 0, "RDRAM") -- did this do something?
- --memory.write_u16_be(0x22FE2, 0, "RDRAM") --41C6 --0 FREEZES RNG
- --memory.write_u16_be(0x22FE4, 10001, "RDRAM")
- --memory.write_u16_be(0x22FE6, 0, "RDRAM") --4E6D --0 FREEZES RNG
- --memory.write_u32_be(0x04D748, 29, "RDRAM") -- RNG
- --memory.writebyte(0x07CAB2,0,"RDRAM")
- --memory.writebyte(0x07CAB5,0,"RDRAM")
- --memory.writebyte(0x07CAB4,0,"RDRAM")
- --memory.writebyte(0x07CAB3,0,"RDRAM")
- --memory.writefloat(0x86FA4, 1600, true, "RDRAM")
- --memory.write_u32_be(0x4D748, 0, "RDRAM")
- --RNG increment 0,N,1 rotates in a circle around you.
- --RNG increment 0,0,0 stays in one spot
- CalcNextRNG(700,430)
- --stackOfJewelsAndWings()
- --HP50()
- --highEncounterCounter()
- --freezeEncounterCounter()
- printEnemyStats(120,620)
- printObjectCoordinates(50,10)
- printEncounterCounter(100,500)
- printStats(100,420)
- printLocation(700,230)
- printAgility(100,230)
- printItems(650,700)
- howManyRocksCurrently(700,320)
- --printMemoryDomains(100,115)
- --printLvTable(100,115,globalLvTable)
- --printStatTable(100,115,globalStatTable)
- emu.frameadvance()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement