memory.usememorydomain("System Bus")
local hp1_data = require 'hp1 data'
local Addresses = hp1_data.Addresses
local text
local read8
local read16
local read32
console.clear()
if vba then
text = gui.text
read8 = memory.readbyteunsigned
read16 = memory.readwordunsigned
read32 = memory.readlongunsigned
else
text = gui.pixelText
memory.usememorydomain("System Bus")
read8 = memory.read_u8
read16 = memory.read_u16_le
read32 = memory.read_u32_le
end
local save_outer = 1
local save_inner = 2
function waitframe(frame)
local game_state = read8(Addresses.game_state) % 128
local story = read8(Addresses.story_flag, "WRAM")
while (frame >= 0) do
text(0, 10,'State: '.. game_state) --Game state for debugging
text(0, 17,'Story: '.. story) --Game state for debugging
emu.frameadvance()
frame = frame-1
end
end
function bot()
local cond_outer = false
local cond_inner = false
local is_pause = false
local changed = false
local frame_start_inner = emu.framecount()
local frame_dif_outer = 0 --difference between this frame and start frame
local frame_dif_inner = 0 --difference between this frame and start frame
local item_start = memory.hash_region(Addresses.item_start, Addresses.item_end - Addresses.item_start, "WRAM")
local card_start = memory.hash_region(Addresses.card_start, Addresses.card_combo_end - Addresses.card_start, "WRAM") --merge combos/cards
local spell_start = memory.hash_region(Addresses.spells, 3)
local item_now = ""
local card_now = ""
local spell_now = ""
savestate.saveslot(save_inner)
repeat
local frame_now_inner = emu.framecount()
local game_state = read8(Addresses.game_state) % 128
local story = read8(Addresses.story_flag,"WRAM")
text(0, 10,'State: '.. game_state) --Game state for debugging
if (frame_dif_inner ~= (frame_now_inner - frame_start_inner)) then --Check just in case
savestate.saveslot(save_inner)
end
--1st menu, selecting Item
-- joypad.set({Down=1})
-- emu.frameadvance()
joypad.set({A=1})
emu.frameadvance()
waitframe(10)
item_now = memory.hash_region(Addresses.item_start, Addresses.item_end - Addresses.item_start, "WRAM")
card_now = memory.hash_region(Addresses.card_start, Addresses.card_combo_end - Addresses.card_start, "WRAM") --merge combos/cards
spell_now = memory.hash_region(Addresses.spells, 3)
frame_dif_inner = frame_dif_inner + 1
game_state = read8(Addresses.game_state) % 128
is_pause = (game_state ~=29 and game_state ~= 30) --and (story ~= 3)
item_changed = item_now ~= item_start
card_changed = card_now ~= card_start
spell_changed = spell_now ~= spell_start
if item_changed == true then
console.log("ITEMS CHANGED")
console.log(emu.framecount())
-- changed = true
end
if card_changed == true then
console.log("CARD CHANGED")
changed = true
end
if spell_changed == true then
console.log("SPELL CHANGED")
changed = true
end
if changed == false then
savestate.loadslot(save_inner)
emu.frameadvance()
end
until (frame_dif_inner > 250 or changed == true)
-- client.pause()
console.log("State:" .. read8(Addresses.game_state) % 128)
console.log("Story:" .. read8(Addresses.story_flag,"WRAM"))
end
bot()
data:
local harry_potter_module = {}
harry_potter_module.Addresses = {
--WRAM, cant be found in System Bus outside bank swap
yes = 0x607F,--item amount for "yes",
item_start = 0x5FFA, --start, to 60FE
item_end = 0x60FE, --start, to 60FE
card_start = 0x650A, --start, to 656E
card_end = 0x656E, --start, to 656E
card_combo_start = 0x6570, --start, to 6576
card_combo_end = 0x6576, --start, to 6576
story_flag = 0x65D5,
--System Bus
monster =
{
x = {0xC46A, 0xC50C, 0xC5AE},
y = {0xC46D, 0xC50F, 0xC5B1},
hp = {0xC4B8, 0xC55A, 0xC5FC}
},
deck_id = 0xCE03, -- Which deck for names
area_id = 0xCCEC,
message_timer = 0xCD12,
x = 0xCD30,
y = 0xCD32,
rng = 0xce04,
boss_id = 0xCC05,
spells = 0xCDFE,
game_state = 0xFFD2,
Start = 0xCAB8,
-- Start = 0xC000,
-- End_ = 0xC100
End_ = 0xCB00
}
return harry_potter_module
https://cdn.discordapp.com/attachments/352025773537755137/1101475665359945808/HPSS_Card.tasproj
I checked the timing for the lightning bug using default combos.
Gulliver Pokeby's deck is the fastest so far.
The following combos do not flicker the screen:
Sickle Seek
Snitch Streak
The following combos causes flicker:
Deflect
Poison Immunity
Summon Umbrella
Conjure Snack
Drone
Tempest
To prevent myself from accidentally losing it:
https://cdn.discordapp.com/attachments/280808167993245707/1155706332301774869/HP1_v7.bk2
Sanqui realized using the Chocolate Frog puts you to WRAM bank 6, which is where items are located. They came up with a payload that took 47k sickles worth of items to setup, which gradually got bought down to 8k.
Rather than use Hogwarts dungeon, I realized I can leave battles using "yes" item, so I warped to the forbidden forest to get OoB, then executed the payload to credits warp.
It beats the game in 36,122 frames, or 10:02.03. I need to check something a bit more before submitting.
https://cdn.discordapp.com/attachments/280808167993245707/1156653184710889542/HP1_v7.bk2
I was trying to improve it, and managed to get a whole bunch of glitched items without crashing.